@massa-ai/tools-api 1.34.0 → 1.35.1

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.
Files changed (2) hide show
  1. package/dist/index.js +9 -9
  2. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -121298,8 +121298,8 @@ class GraphGenerationRepositoryPg {
121298
121298
  async heartbeat(lease, leaseTtlMs) {
121299
121299
  const ttl = validateTtl2(leaseTtlMs);
121300
121300
  return getPrismaClient2().$transaction(async (tx) => {
121301
- const workspace = await lockWorkspace(tx, lease.projectId);
121302
121301
  const generation = await lockGeneration(tx, lease.projectId, lease.generationId);
121302
+ const workspace = await lockWorkspace(tx, lease.projectId);
121303
121303
  if (!leaseMatches(workspace, generation, lease))
121304
121304
  return { status: "lease_lost" };
121305
121305
  const renewed = await tx.$queryRaw`
@@ -121322,8 +121322,8 @@ class GraphGenerationRepositoryPg {
121322
121322
  }
121323
121323
  async complete(lease) {
121324
121324
  return getPrismaClient2().$transaction(async (tx) => {
121325
- const workspace = await lockWorkspace(tx, lease.projectId);
121326
121325
  const generation = await lockGeneration(tx, lease.projectId, lease.generationId);
121326
+ const workspace = await lockWorkspace(tx, lease.projectId);
121327
121327
  if (!leaseMatches(workspace, generation, lease))
121328
121328
  return { status: "lease_lost" };
121329
121329
  const live = await tx.$queryRaw`
@@ -121352,8 +121352,8 @@ class GraphGenerationRepositoryPg {
121352
121352
  }
121353
121353
  async activate(lease) {
121354
121354
  return getPrismaClient2().$transaction(async (tx) => {
121355
- const workspace = await lockWorkspace(tx, lease.projectId);
121356
121355
  const generation = await lockGeneration(tx, lease.projectId, lease.generationId);
121356
+ const workspace = await lockWorkspace(tx, lease.projectId);
121357
121357
  if (!leaseMatches(workspace, generation, lease))
121358
121358
  return { status: "lease_lost" };
121359
121359
  if (workspace.active_graph_generation_id !== generation.expected_active_id) {
@@ -121403,8 +121403,8 @@ class GraphGenerationRepositoryPg {
121403
121403
  async abort(lease, reason) {
121404
121404
  const failureReason = boundedText2(reason, "reason", MAX_FAILURE_REASON);
121405
121405
  return getPrismaClient2().$transaction(async (tx) => {
121406
- const workspace = await lockWorkspace(tx, lease.projectId);
121407
121406
  const generation = await lockGeneration(tx, lease.projectId, lease.generationId);
121407
+ const workspace = await lockWorkspace(tx, lease.projectId);
121408
121408
  if (!leaseMatches(workspace, generation, lease))
121409
121409
  return { status: "lease_lost" };
121410
121410
  const live = await tx.$queryRaw`
@@ -121480,7 +121480,7 @@ class GraphGenerationCoordinator {
121480
121480
  async begin(input) {
121481
121481
  const deadline = Date.now() + GRAPH_GENERATION_LEASE_TTL_MS;
121482
121482
  for (;; ) {
121483
- const outcome2 = await this.repository.begin({ ...input, leaseTtlMs: GRAPH_GENERATION_LEASE_TTL_MS });
121483
+ const outcome2 = await withDeadlockRetry(() => this.repository.begin({ ...input, leaseTtlMs: GRAPH_GENERATION_LEASE_TTL_MS }), { operation: "graph_generation.begin", maxAttempts: 5 });
121484
121484
  if (outcome2.status === "acquired")
121485
121485
  return outcome2.lease;
121486
121486
  if (outcome2.status === "stale_active") {
@@ -121492,12 +121492,12 @@ class GraphGenerationCoordinator {
121492
121492
  }
121493
121493
  }
121494
121494
  async heartbeat(lease) {
121495
- const outcome2 = await withDeadlockRetry(() => this.repository.heartbeat(lease, GRAPH_GENERATION_LEASE_TTL_MS), { operation: "graph_generation.heartbeat", maxAttempts: 3 });
121495
+ const outcome2 = await withDeadlockRetry(() => this.repository.heartbeat(lease, GRAPH_GENERATION_LEASE_TTL_MS), { operation: "graph_generation.heartbeat", maxAttempts: 5 });
121496
121496
  if (outcome2.status !== "renewed")
121497
121497
  throw new Error("graph_generation_lease_lost");
121498
121498
  }
121499
121499
  async activate(lease) {
121500
- const completeness = await this.repository.complete(lease);
121500
+ const completeness = await withDeadlockRetry(() => this.repository.complete(lease), { operation: "graph_generation.complete", maxAttempts: 5 });
121501
121501
  if (completeness.status === "incomplete") {
121502
121502
  throw new Error(`graph_generation_incomplete:${completeness.reasons.join(",")}`);
121503
121503
  }
@@ -121506,7 +121506,7 @@ class GraphGenerationCoordinator {
121506
121506
  if (completeness.status === "stale_active") {
121507
121507
  throw new Error(`graph_generation_stale_active:${completeness.activeGenerationId ?? "none"}`);
121508
121508
  }
121509
- const activation = await this.repository.activate(lease);
121509
+ const activation = await withDeadlockRetry(() => this.repository.activate(lease), { operation: "graph_generation.activate", maxAttempts: 5 });
121510
121510
  if (activation.status === "activated")
121511
121511
  return activation;
121512
121512
  if (activation.status === "incomplete") {
@@ -121517,7 +121517,7 @@ class GraphGenerationCoordinator {
121517
121517
  throw new Error(`graph_generation_stale_active:${activation.activeGenerationId ?? "none"}`);
121518
121518
  }
121519
121519
  async abort(lease, reason) {
121520
- const outcome2 = await this.repository.abort(lease, reason);
121520
+ const outcome2 = await withDeadlockRetry(() => this.repository.abort(lease, reason), { operation: "graph_generation.abort", maxAttempts: 5 });
121521
121521
  if (outcome2.status === "lease_lost")
121522
121522
  throw new Error("graph_generation_lease_lost_during_abort");
121523
121523
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@massa-ai/tools-api",
3
- "version": "1.34.0",
3
+ "version": "1.35.1",
4
4
  "author": "luizgmassa",
5
5
  "description": "massa-ai REST API server - Semantic code search, memory, and context compression",
6
6
  "type": "module",
@@ -21,8 +21,8 @@
21
21
  "test": "bun scripts/run-tests-isolated.ts"
22
22
  },
23
23
  "dependencies": {
24
- "@massa-ai/core": "^1.34.0",
25
- "@massa-ai/shared": "^1.34.0",
24
+ "@massa-ai/core": "^1.35.1",
25
+ "@massa-ai/shared": "^1.35.1",
26
26
  "elysia": "^1.2.25",
27
27
  "@elysiajs/swagger": "^1.2.0",
28
28
  "@elysiajs/cors": "^1.2.0",