@hasna/mementos 0.14.84 → 0.14.85
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/dist/cli/commands/info-history.d.ts.map +1 -1
- package/dist/cli/commands/info-stale.d.ts.map +1 -1
- package/dist/cli/commands/io-export.d.ts.map +1 -1
- package/dist/cli/commands/memory-cmd-list.d.ts.map +1 -1
- package/dist/cli/helpers.d.ts +31 -0
- package/dist/cli/helpers.d.ts.map +1 -1
- package/dist/cli/index.js +350 -73
- package/dist/db/analytics.d.ts +13 -0
- package/dist/db/analytics.d.ts.map +1 -1
- package/dist/db/api-mode.d.ts.map +1 -1
- package/dist/db/memories.d.ts +59 -3
- package/dist/db/memories.d.ts.map +1 -1
- package/dist/diagnostics/historical-project-registration-receipt.d.ts +39 -0
- package/dist/diagnostics/historical-project-registration-receipt.d.ts.map +1 -0
- package/dist/diagnostics/historical-project-registration-receipt.js +1656 -0
- package/dist/index.js +204 -35
- package/dist/lib/gatherer.d.ts.map +1 -1
- package/dist/mcp/index.js +238 -39
- package/dist/mcp/tools/memory-io.d.ts.map +1 -1
- package/dist/project-registration/authority.d.ts.map +1 -1
- package/dist/project-registration/historical-receipt.d.ts +38 -0
- package/dist/project-registration/historical-receipt.d.ts.map +1 -0
- package/dist/project-registration/identity.d.ts.map +1 -1
- package/dist/project-registration/index.d.ts +1 -1
- package/dist/project-registration/index.d.ts.map +1 -1
- package/dist/project-registration/types.d.ts +26 -0
- package/dist/project-registration/types.d.ts.map +1 -1
- package/dist/project-registration.js +201 -32
- package/dist/sdk/index.d.ts +7 -0
- package/dist/sdk/index.d.ts.map +1 -1
- package/dist/sdk/index.js +122 -30
- package/dist/server/index.js +312 -56
- package/dist/test-support/memories-page-stub-server.d.ts +2 -0
- package/dist/test-support/memories-page-stub-server.d.ts.map +1 -0
- package/dist/test-support/memories-page-stub.d.ts +28 -0
- package/dist/test-support/memories-page-stub.d.ts.map +1 -0
- package/package.json +3 -2
package/dist/index.js
CHANGED
|
@@ -1147,7 +1147,16 @@ x-api-key: ${cfg.apiKey}
|
|
|
1147
1147
|
function apiJson(method, path, body, options) {
|
|
1148
1148
|
const raw = apiRequestRaw(method, path, body);
|
|
1149
1149
|
if (raw.status >= 200 && raw.status < 300) {
|
|
1150
|
-
|
|
1150
|
+
let data;
|
|
1151
|
+
if (raw.body.trim()) {
|
|
1152
|
+
try {
|
|
1153
|
+
data = JSON.parse(raw.body);
|
|
1154
|
+
} catch (e) {
|
|
1155
|
+
throw new ApiRequestError(`mementos cloud ${method} ${path} returned status ${raw.status} with a body that is not valid JSON (${e instanceof Error ? e.message : String(e)}) \u2014 the response is truncated or the server is unhealthy`, raw.status, raw.body.slice(0, 500));
|
|
1156
|
+
}
|
|
1157
|
+
} else {
|
|
1158
|
+
data = undefined;
|
|
1159
|
+
}
|
|
1151
1160
|
return { status: raw.status, data };
|
|
1152
1161
|
}
|
|
1153
1162
|
if (raw.status === 404 && options?.allow404) {
|
|
@@ -16416,7 +16425,7 @@ class JSONSchemaGenerator {
|
|
|
16416
16425
|
if (val === undefined) {
|
|
16417
16426
|
if (this.unrepresentable === "throw") {
|
|
16418
16427
|
throw new Error("Literal `undefined` cannot be represented in JSON Schema");
|
|
16419
|
-
}
|
|
16428
|
+
}
|
|
16420
16429
|
} else if (typeof val === "bigint") {
|
|
16421
16430
|
if (this.unrepresentable === "throw") {
|
|
16422
16431
|
throw new Error("BigInt literals cannot be represented in JSON Schema");
|
|
@@ -38066,7 +38075,7 @@ var require_tracestate_impl = __commonJS((exports) => {
|
|
|
38066
38075
|
const value = listMember.slice(i + 1, part.length);
|
|
38067
38076
|
if ((0, tracestate_validators_1.validateKey)(key) && (0, tracestate_validators_1.validateValue)(value)) {
|
|
38068
38077
|
agg.set(key, value);
|
|
38069
|
-
}
|
|
38078
|
+
}
|
|
38070
38079
|
}
|
|
38071
38080
|
return agg;
|
|
38072
38081
|
}, new Map);
|
|
@@ -52119,29 +52128,7 @@ function getMemoriesByKey(key, scope, agentId, projectId, db) {
|
|
|
52119
52128
|
const rows = d.query(sql).all(...params);
|
|
52120
52129
|
return rows.map(parseMemoryRow);
|
|
52121
52130
|
}
|
|
52122
|
-
function
|
|
52123
|
-
if (!db && isApiMode()) {
|
|
52124
|
-
const f = filter || {};
|
|
52125
|
-
const q = toQuery({
|
|
52126
|
-
key: f.key,
|
|
52127
|
-
scope: f.scope,
|
|
52128
|
-
category: f.category,
|
|
52129
|
-
status: f.status,
|
|
52130
|
-
tags: f.tags,
|
|
52131
|
-
min_importance: f.min_importance,
|
|
52132
|
-
pinned: f.pinned,
|
|
52133
|
-
agent_id: f.agent_id,
|
|
52134
|
-
project_id: f.project_id,
|
|
52135
|
-
session_id: f.session_id,
|
|
52136
|
-
namespace: f.namespace,
|
|
52137
|
-
as_of: f.as_of,
|
|
52138
|
-
limit: f.limit,
|
|
52139
|
-
offset: f.offset
|
|
52140
|
-
});
|
|
52141
|
-
const { data } = apiJson("GET", `/memories${q}`);
|
|
52142
|
-
return data?.memories ?? [];
|
|
52143
|
-
}
|
|
52144
|
-
const d = db || getDatabase();
|
|
52131
|
+
function buildMemoryListConditions(filter) {
|
|
52145
52132
|
const conditions = [];
|
|
52146
52133
|
const params = [];
|
|
52147
52134
|
if (filter) {
|
|
@@ -52253,21 +52240,99 @@ function listMemories(filter, db) {
|
|
|
52253
52240
|
} else {
|
|
52254
52241
|
conditions.push("status = 'active'");
|
|
52255
52242
|
}
|
|
52243
|
+
return { conditions, params };
|
|
52244
|
+
}
|
|
52245
|
+
function listMemoriesPage(filter, db) {
|
|
52246
|
+
const f = filter || {};
|
|
52247
|
+
if (!db && isApiMode()) {
|
|
52248
|
+
const q = toQuery({
|
|
52249
|
+
key: f.key,
|
|
52250
|
+
scope: f.scope,
|
|
52251
|
+
category: f.category,
|
|
52252
|
+
status: f.status,
|
|
52253
|
+
tags: f.tags,
|
|
52254
|
+
min_importance: f.min_importance,
|
|
52255
|
+
pinned: f.pinned,
|
|
52256
|
+
agent_id: f.agent_id,
|
|
52257
|
+
project_id: f.project_id,
|
|
52258
|
+
session_id: f.session_id,
|
|
52259
|
+
namespace: f.namespace,
|
|
52260
|
+
as_of: f.as_of,
|
|
52261
|
+
limit: f.limit,
|
|
52262
|
+
offset: f.offset
|
|
52263
|
+
});
|
|
52264
|
+
const { data } = apiJson("GET", `/memories${q}`);
|
|
52265
|
+
return {
|
|
52266
|
+
rows: data?.memories ?? [],
|
|
52267
|
+
has_more: data?.has_more,
|
|
52268
|
+
next_cursor: data?.next_cursor ?? null
|
|
52269
|
+
};
|
|
52270
|
+
}
|
|
52271
|
+
const d = db || getDatabase();
|
|
52272
|
+
const { conditions, params } = buildMemoryListConditions(f);
|
|
52256
52273
|
let sql = "SELECT * FROM memories";
|
|
52257
52274
|
if (conditions.length > 0) {
|
|
52258
52275
|
sql += ` WHERE ${conditions.join(" AND ")}`;
|
|
52259
52276
|
}
|
|
52260
52277
|
sql += " ORDER BY importance DESC, created_at DESC";
|
|
52261
|
-
if (
|
|
52278
|
+
if (f.limit) {
|
|
52262
52279
|
sql += " LIMIT ?";
|
|
52263
|
-
params.push(
|
|
52280
|
+
params.push(f.limit);
|
|
52264
52281
|
}
|
|
52265
|
-
if (
|
|
52282
|
+
if (f.offset) {
|
|
52266
52283
|
sql += " OFFSET ?";
|
|
52267
|
-
params.push(
|
|
52284
|
+
params.push(f.offset);
|
|
52268
52285
|
}
|
|
52269
52286
|
const rows = d.query(sql).all(...params);
|
|
52270
|
-
|
|
52287
|
+
const parsed = rows.map(parseMemoryRow);
|
|
52288
|
+
const hasMore = f.limit !== undefined && parsed.length === f.limit;
|
|
52289
|
+
return {
|
|
52290
|
+
rows: parsed,
|
|
52291
|
+
has_more: hasMore,
|
|
52292
|
+
next_cursor: hasMore ? (f.offset ?? 0) + parsed.length : null
|
|
52293
|
+
};
|
|
52294
|
+
}
|
|
52295
|
+
function listMemories(filter, db) {
|
|
52296
|
+
return listMemoriesPage(filter, db).rows;
|
|
52297
|
+
}
|
|
52298
|
+
function listMemoriesBounded(filter = {}, target, db) {
|
|
52299
|
+
const pageSize = 1000;
|
|
52300
|
+
const maxPages = 1000;
|
|
52301
|
+
const want = target === undefined ? undefined : target + 1;
|
|
52302
|
+
const rows = [];
|
|
52303
|
+
const seenCursors = new Set;
|
|
52304
|
+
let cursor = filter.offset ?? 0;
|
|
52305
|
+
let pages = 0;
|
|
52306
|
+
for (;; ) {
|
|
52307
|
+
if (want !== undefined && rows.length >= want)
|
|
52308
|
+
break;
|
|
52309
|
+
if (++pages > maxPages) {
|
|
52310
|
+
throw new Error(`memories list traversal exceeded ${maxPages} pages while collecting rows \u2014 aborting (cursor cycle?)`);
|
|
52311
|
+
}
|
|
52312
|
+
const limit = Math.min(want === undefined ? pageSize : want - rows.length, pageSize);
|
|
52313
|
+
const page = listMemoriesPage({ ...filter, limit, offset: cursor }, db);
|
|
52314
|
+
rows.push(...page.rows);
|
|
52315
|
+
if (page.has_more === false)
|
|
52316
|
+
break;
|
|
52317
|
+
if (page.has_more === undefined && page.rows.length < limit)
|
|
52318
|
+
break;
|
|
52319
|
+
if (page.has_more === true && (page.next_cursor === null || page.next_cursor === undefined)) {
|
|
52320
|
+
throw new Error("memories list page claimed more results without a next cursor \u2014 aborting");
|
|
52321
|
+
}
|
|
52322
|
+
const next = page.next_cursor ?? cursor + page.rows.length;
|
|
52323
|
+
if (seenCursors.has(next)) {
|
|
52324
|
+
throw new Error("memories list traversal repeated a cursor \u2014 aborting");
|
|
52325
|
+
}
|
|
52326
|
+
seenCursors.add(next);
|
|
52327
|
+
cursor = next;
|
|
52328
|
+
}
|
|
52329
|
+
const hasMore = target !== undefined && rows.length > target;
|
|
52330
|
+
const trimmed = hasMore ? rows.slice(0, target) : rows;
|
|
52331
|
+
return {
|
|
52332
|
+
rows: trimmed,
|
|
52333
|
+
has_more: hasMore,
|
|
52334
|
+
next_cursor: hasMore ? (filter.offset ?? 0) + trimmed.length : null
|
|
52335
|
+
};
|
|
52271
52336
|
}
|
|
52272
52337
|
function updateMemory(id, input, db) {
|
|
52273
52338
|
if (!db && isApiMode()) {
|
|
@@ -52514,6 +52579,90 @@ class MementosProjectRegistrationError extends Error {
|
|
|
52514
52579
|
}
|
|
52515
52580
|
}
|
|
52516
52581
|
|
|
52582
|
+
// src/project-registration/historical-receipt.ts
|
|
52583
|
+
var ROOT_TENANT_ID = "adfd95c7-ee8b-52cb-ae47-4ae65dae3313";
|
|
52584
|
+
var FLEET_RESOURCES_HISTORICAL_PROJECT_REGISTRATION = {
|
|
52585
|
+
authority: "mementos",
|
|
52586
|
+
authority_route: "mementos.project-registration.v1",
|
|
52587
|
+
package_version: "1.0.0-rc.3",
|
|
52588
|
+
authority_id: "mementos",
|
|
52589
|
+
tenant_id: "default",
|
|
52590
|
+
corpus_id: "default",
|
|
52591
|
+
operation_id: "op-cli-register-full",
|
|
52592
|
+
step_id: "mementos_project",
|
|
52593
|
+
resource_kind: "project",
|
|
52594
|
+
direction: "forward",
|
|
52595
|
+
target_selector: "wks_005285827590a93b70e5",
|
|
52596
|
+
target_id: "mm_project_f75606ef14e51fb577a15882ba0ab8ed333b2c29",
|
|
52597
|
+
idempotency_key: "prk_786cdc6babddeae1be8d5078d0f75322d1ea1010ac5d8a50",
|
|
52598
|
+
receipt_id: "mmpr_a647f9908a33bb64bf137f584202590f91b72a33",
|
|
52599
|
+
request_digest: "8eb0e3fee26fdb7edb8a444aeddaaedb79a84a5a36e742ae03616f62b19f5c22",
|
|
52600
|
+
precondition_digest: "0b6c22fcf75d835f9f27308b1a9d40e8902e48a97da370fd56df5acacfcd968e",
|
|
52601
|
+
result_revision: "2026-08-09T13:37:43.068Z",
|
|
52602
|
+
result_digest: "26fb0dd5c5e20909d3653ab0ddd8fa45e5142728e4e66d595e2419f7ed40b036",
|
|
52603
|
+
created_at: "2026-08-09T13:37:43.068Z",
|
|
52604
|
+
identity_digest: "1108dd972c90e4989036fb6ecec7dde10f54641a697bd53cfcd64017f589ace7",
|
|
52605
|
+
target_digest: "72789fcd60668eeb66ee068936d3afa96deadcb007228830c64b6de783b6dcef",
|
|
52606
|
+
operation_digest: "d7e37bfb2c0d28f8c4086c53224cd855d14694f32807b74c102b61a99963f3c0",
|
|
52607
|
+
idempotency_digest: "b56d8ec37efb818759cdd2ee3b58bc1401ac13384c8d64c1813bb5c198b1e376",
|
|
52608
|
+
receipt_digest: "52ce90c5de6817989f107d9d27e06156962a2b9c365e34e16a57aa37886501a2",
|
|
52609
|
+
response_digest: "2fa3ed508f5f192c18753b1205ced996340fdf02f735420d32db897fc239805c"
|
|
52610
|
+
};
|
|
52611
|
+
var FLEET_RESOURCES_HISTORICAL_RECEIPT = {
|
|
52612
|
+
receipt_id: FLEET_RESOURCES_HISTORICAL_PROJECT_REGISTRATION.receipt_id,
|
|
52613
|
+
authority: FLEET_RESOURCES_HISTORICAL_PROJECT_REGISTRATION.authority,
|
|
52614
|
+
route: FLEET_RESOURCES_HISTORICAL_PROJECT_REGISTRATION.authority_route,
|
|
52615
|
+
package_version: FLEET_RESOURCES_HISTORICAL_PROJECT_REGISTRATION.package_version,
|
|
52616
|
+
authority_id: FLEET_RESOURCES_HISTORICAL_PROJECT_REGISTRATION.authority_id,
|
|
52617
|
+
tenant_id: FLEET_RESOURCES_HISTORICAL_PROJECT_REGISTRATION.tenant_id,
|
|
52618
|
+
corpus_id: FLEET_RESOURCES_HISTORICAL_PROJECT_REGISTRATION.corpus_id,
|
|
52619
|
+
operation_id: FLEET_RESOURCES_HISTORICAL_PROJECT_REGISTRATION.operation_id,
|
|
52620
|
+
step_id: FLEET_RESOURCES_HISTORICAL_PROJECT_REGISTRATION.step_id,
|
|
52621
|
+
resource_kind: FLEET_RESOURCES_HISTORICAL_PROJECT_REGISTRATION.resource_kind,
|
|
52622
|
+
direction: FLEET_RESOURCES_HISTORICAL_PROJECT_REGISTRATION.direction,
|
|
52623
|
+
idempotency_key: FLEET_RESOURCES_HISTORICAL_PROJECT_REGISTRATION.idempotency_key,
|
|
52624
|
+
request_digest: FLEET_RESOURCES_HISTORICAL_PROJECT_REGISTRATION.request_digest,
|
|
52625
|
+
precondition_digest: FLEET_RESOURCES_HISTORICAL_PROJECT_REGISTRATION.precondition_digest,
|
|
52626
|
+
outcome: "accepted",
|
|
52627
|
+
reason: null,
|
|
52628
|
+
target_id: FLEET_RESOURCES_HISTORICAL_PROJECT_REGISTRATION.target_id,
|
|
52629
|
+
result_revision: FLEET_RESOURCES_HISTORICAL_PROJECT_REGISTRATION.result_revision,
|
|
52630
|
+
result_digest: FLEET_RESOURCES_HISTORICAL_PROJECT_REGISTRATION.result_digest,
|
|
52631
|
+
duplicate_of_receipt_id: null,
|
|
52632
|
+
accepted_receipt_id: null,
|
|
52633
|
+
created_by_operation: true,
|
|
52634
|
+
created_at: FLEET_RESOURCES_HISTORICAL_PROJECT_REGISTRATION.created_at
|
|
52635
|
+
};
|
|
52636
|
+
var FLEET_RESOURCES_CURRENT_PROJECT_REGISTRATION_IDENTITY = {
|
|
52637
|
+
authority_id: "mementos",
|
|
52638
|
+
tenant_id: ROOT_TENANT_ID,
|
|
52639
|
+
corpus_id: "mementos:postgresql"
|
|
52640
|
+
};
|
|
52641
|
+
var FLEET_RESOURCES_HISTORICAL_LOOKUP_IDENTITY = {
|
|
52642
|
+
source: {
|
|
52643
|
+
authority: FLEET_RESOURCES_HISTORICAL_PROJECT_REGISTRATION.authority,
|
|
52644
|
+
authority_route: FLEET_RESOURCES_HISTORICAL_PROJECT_REGISTRATION.authority_route,
|
|
52645
|
+
package_version: FLEET_RESOURCES_HISTORICAL_PROJECT_REGISTRATION.package_version,
|
|
52646
|
+
authority_id: FLEET_RESOURCES_HISTORICAL_PROJECT_REGISTRATION.authority_id,
|
|
52647
|
+
tenant_id: FLEET_RESOURCES_HISTORICAL_PROJECT_REGISTRATION.tenant_id,
|
|
52648
|
+
corpus_id: FLEET_RESOURCES_HISTORICAL_PROJECT_REGISTRATION.corpus_id,
|
|
52649
|
+
operation_id: FLEET_RESOURCES_HISTORICAL_PROJECT_REGISTRATION.operation_id,
|
|
52650
|
+
step_id: FLEET_RESOURCES_HISTORICAL_PROJECT_REGISTRATION.step_id,
|
|
52651
|
+
resource_kind: FLEET_RESOURCES_HISTORICAL_PROJECT_REGISTRATION.resource_kind,
|
|
52652
|
+
direction: FLEET_RESOURCES_HISTORICAL_PROJECT_REGISTRATION.direction,
|
|
52653
|
+
target_selector: FLEET_RESOURCES_HISTORICAL_PROJECT_REGISTRATION.target_selector,
|
|
52654
|
+
target_id: FLEET_RESOURCES_HISTORICAL_PROJECT_REGISTRATION.target_id,
|
|
52655
|
+
idempotency_key: FLEET_RESOURCES_HISTORICAL_PROJECT_REGISTRATION.idempotency_key,
|
|
52656
|
+
receipt_id: FLEET_RESOURCES_HISTORICAL_PROJECT_REGISTRATION.receipt_id
|
|
52657
|
+
},
|
|
52658
|
+
destination: FLEET_RESOURCES_CURRENT_PROJECT_REGISTRATION_IDENTITY,
|
|
52659
|
+
lookup_only: true,
|
|
52660
|
+
immutable_receipt: true
|
|
52661
|
+
};
|
|
52662
|
+
function supportsFleetResourcesHistoricalReceiptLookup(capability) {
|
|
52663
|
+
return capability.authority_id === FLEET_RESOURCES_CURRENT_PROJECT_REGISTRATION_IDENTITY.authority_id && capability.tenant_id === FLEET_RESOURCES_CURRENT_PROJECT_REGISTRATION_IDENTITY.tenant_id && capability.corpus_id === FLEET_RESOURCES_CURRENT_PROJECT_REGISTRATION_IDENTITY.corpus_id;
|
|
52664
|
+
}
|
|
52665
|
+
|
|
52517
52666
|
// src/project-registration/identity.ts
|
|
52518
52667
|
var MEMENTOS_PROJECT_AUTHORITY_ENV = {
|
|
52519
52668
|
authorityId: "MEMENTOS_PROJECT_AUTHORITY_ID",
|
|
@@ -52555,12 +52704,13 @@ function resolveMementosProjectAuthorityIdentity(options = {}) {
|
|
|
52555
52704
|
}
|
|
52556
52705
|
function buildMementosProjectRegistrationCapability(options = {}) {
|
|
52557
52706
|
const identity = resolveMementosProjectAuthorityIdentity(options);
|
|
52558
|
-
|
|
52707
|
+
const capability = {
|
|
52559
52708
|
authority: "mementos",
|
|
52560
52709
|
route: MEMENTOS_PROJECT_REGISTRATION_ROUTE,
|
|
52561
52710
|
package_version: options.packageVersion ?? getMementosPackageVersion(),
|
|
52562
52711
|
...identity,
|
|
52563
52712
|
supported_resources: ["project"],
|
|
52713
|
+
supported_historical_lookup_identities: [],
|
|
52564
52714
|
conditional_create: true,
|
|
52565
52715
|
immutable_receipts: true,
|
|
52566
52716
|
exact_terminal_lookup: true,
|
|
@@ -52579,6 +52729,12 @@ function buildMementosProjectRegistrationCapability(options = {}) {
|
|
|
52579
52729
|
stable_keyset_pagination: true,
|
|
52580
52730
|
explicit_membership_only: true
|
|
52581
52731
|
};
|
|
52732
|
+
if (supportsFleetResourcesHistoricalReceiptLookup(capability)) {
|
|
52733
|
+
capability.supported_historical_lookup_identities = [
|
|
52734
|
+
FLEET_RESOURCES_HISTORICAL_LOOKUP_IDENTITY
|
|
52735
|
+
];
|
|
52736
|
+
}
|
|
52737
|
+
return capability;
|
|
52582
52738
|
}
|
|
52583
52739
|
|
|
52584
52740
|
// src/db/memory-project-link.ts
|
|
@@ -54730,12 +54886,21 @@ function assertInverseRequest(request, capability) {
|
|
|
54730
54886
|
}
|
|
54731
54887
|
return accepted;
|
|
54732
54888
|
}
|
|
54889
|
+
function matchesCurrentLookupIdentity(request, capability) {
|
|
54890
|
+
return request.authority_route === capability.route && request.package_version === capability.package_version && request.authority_id === capability.authority_id && request.tenant_id === capability.tenant_id && request.corpus_id === capability.corpus_id;
|
|
54891
|
+
}
|
|
54892
|
+
function matchesFleetResourcesHistoricalLookup(request, capability) {
|
|
54893
|
+
if (!supportsFleetResourcesHistoricalReceiptLookup(capability))
|
|
54894
|
+
return false;
|
|
54895
|
+
const source = FLEET_RESOURCES_HISTORICAL_LOOKUP_IDENTITY.source;
|
|
54896
|
+
return request.authority === source.authority && request.authority_route === source.authority_route && request.package_version === source.package_version && request.authority_id === source.authority_id && request.tenant_id === source.tenant_id && request.corpus_id === source.corpus_id && request.operation_id === source.operation_id && request.step_id === source.step_id && request.resource_kind === source.resource_kind && request.direction === source.direction && request.target_selector === source.target_selector && request.target_id === source.target_id && request.idempotency_key === source.idempotency_key;
|
|
54897
|
+
}
|
|
54733
54898
|
function assertLookup(request, capability) {
|
|
54734
54899
|
assertBounds(request);
|
|
54735
54900
|
if (request.max_items !== 1) {
|
|
54736
54901
|
throw new MementosProjectRegistrationError("MEMENTOS_PROJECT_REGISTRATION_INVALID_BOUNDS", "terminal receipt lookup requires max_items exactly 1");
|
|
54737
54902
|
}
|
|
54738
|
-
if (request.authority !== "mementos" || request.resource_kind !== "project" || request
|
|
54903
|
+
if (request.authority !== "mementos" || request.resource_kind !== "project" || !matchesCurrentLookupIdentity(request, capability) && !matchesFleetResourcesHistoricalLookup(request, capability)) {
|
|
54739
54904
|
throw new MementosProjectRegistrationError("MEMENTOS_PROJECT_REGISTRATION_CAPABILITY_MISMATCH", "receipt lookup does not match this authority capability identity");
|
|
54740
54905
|
}
|
|
54741
54906
|
requireString(request.operation_id, "operation_id", { pattern: OPERATION_PATTERN });
|
|
@@ -54753,6 +54918,7 @@ function assertLookup(request, capability) {
|
|
|
54753
54918
|
pattern: PROJECT_ID_PATTERN
|
|
54754
54919
|
});
|
|
54755
54920
|
}
|
|
54921
|
+
return matchesCurrentLookupIdentity(request, capability) ? "current" : "fleet_resources_historical";
|
|
54756
54922
|
}
|
|
54757
54923
|
|
|
54758
54924
|
class PackageOwnedMementosProjectRegistrationAuthority {
|
|
@@ -55017,11 +55183,14 @@ class PackageOwnedMementosProjectRegistrationAuthority {
|
|
|
55017
55183
|
}
|
|
55018
55184
|
async lookupReceipt(request) {
|
|
55019
55185
|
const startedAt = Date.now();
|
|
55020
|
-
assertLookup(request, this.capabilityValue);
|
|
55186
|
+
const lookupIdentity = assertLookup(request, this.capabilityValue);
|
|
55021
55187
|
const receipt = getReceiptForLookup(this.db, request);
|
|
55022
55188
|
if (!receipt || request.target_id !== undefined && receipt.target_id !== request.target_id) {
|
|
55023
55189
|
throw new MementosProjectRegistrationError("MEMENTOS_PROJECT_REGISTRATION_RECEIPT_NOT_FOUND", "exact immutable terminal receipt was not found");
|
|
55024
55190
|
}
|
|
55191
|
+
if (lookupIdentity === "fleet_resources_historical" && (receipt.receipt_id !== FLEET_RESOURCES_HISTORICAL_LOOKUP_IDENTITY.source.receipt_id || canonicalMementosProjectRegistrationJson(publicReceipt(receipt)) !== canonicalMementosProjectRegistrationJson(FLEET_RESOURCES_HISTORICAL_RECEIPT))) {
|
|
55192
|
+
throw new MementosProjectRegistrationError("MEMENTOS_PROJECT_REGISTRATION_RECEIPT_NOT_FOUND", "exact immutable historical terminal receipt was not found");
|
|
55193
|
+
}
|
|
55025
55194
|
return withResponseControl(publicReceipt(receipt), request, startedAt);
|
|
55026
55195
|
}
|
|
55027
55196
|
async compensate(request) {
|
|
@@ -60104,7 +60273,7 @@ ${matched.map((m) => `- ${m.key}: ${m.value.slice(0, 120)}${m.value.length > 120
|
|
|
60104
60273
|
};
|
|
60105
60274
|
}
|
|
60106
60275
|
var gatherTrainingData = async (options = {}) => {
|
|
60107
|
-
const allMemories =
|
|
60276
|
+
const allMemories = listMemoriesBounded({ status: "active" }, undefined).rows;
|
|
60108
60277
|
const filtered = options.since ? allMemories.filter((m) => new Date(m.created_at) >= options.since) : allMemories;
|
|
60109
60278
|
const sorted = filtered.slice().sort((a, b) => b.importance - a.importance);
|
|
60110
60279
|
const fetchSet = options.limit ? sorted.slice(0, options.limit * 3) : sorted;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gatherer.d.ts","sourceRoot":"","sources":["../../src/lib/gatherer.ts"],"names":[],"mappings":"AAMA,KAAK,oBAAoB,GAAG,CAAC,OAAO,CAAC,EAAE;IACrC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,IAAI,CAAC;CACd,KAAK,OAAO,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,KAAK,CAAC;QACd,QAAQ,EAAE,KAAK,CAAC;YAAE,IAAI,EAAE,QAAQ,GAAG,MAAM,GAAG,WAAW,CAAC;YAAC,OAAO,EAAE,MAAM,CAAA;SAAE,CAAC,CAAC;KAC7E,CAAC,CAAC;IACH,KAAK,EAAE,MAAM,CAAC;CACf,CAAC,CAAC;AAyEH,eAAO,MAAM,kBAAkB,EAAE,
|
|
1
|
+
{"version":3,"file":"gatherer.d.ts","sourceRoot":"","sources":["../../src/lib/gatherer.ts"],"names":[],"mappings":"AAMA,KAAK,oBAAoB,GAAG,CAAC,OAAO,CAAC,EAAE;IACrC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,IAAI,CAAC;CACd,KAAK,OAAO,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,KAAK,CAAC;QACd,QAAQ,EAAE,KAAK,CAAC;YAAE,IAAI,EAAE,QAAQ,GAAG,MAAM,GAAG,WAAW,CAAC;YAAC,OAAO,EAAE,MAAM,CAAA;SAAE,CAAC,CAAC;KAC7E,CAAC,CAAC;IACH,KAAK,EAAE,MAAM,CAAC;CACf,CAAC,CAAC;AAyEH,eAAO,MAAM,kBAAkB,EAAE,oBAkDhC,CAAC"}
|