@arke-institute/sdk 2.3.13 → 2.3.14

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.
@@ -6,7 +6,7 @@
6
6
  *
7
7
  * Source: Arke v1 API
8
8
  * Version: 1.0.0
9
- * Generated: 2026-01-22T16:50:20.274Z
9
+ * Generated: 2026-01-22T18:25:50.170Z
10
10
  */
11
11
  type paths = {
12
12
  "/ops-reference": {
@@ -2431,6 +2431,172 @@ type paths = {
2431
2431
  patch?: never;
2432
2432
  trace?: never;
2433
2433
  };
2434
+ "/entities/{id}/cascade": {
2435
+ parameters: {
2436
+ query?: never;
2437
+ header?: never;
2438
+ path?: never;
2439
+ cookie?: never;
2440
+ };
2441
+ get?: never;
2442
+ put?: never;
2443
+ post?: never;
2444
+ /**
2445
+ * Cascade delete entity and related entities
2446
+ * @description Deletes an entity and all related entities matching predicate patterns within a scoped collection.
2447
+ *
2448
+ * **Permission Model:**
2449
+ * - Requires `entity:delete` permission on the specified `collection_id`
2450
+ * - Single permission check at the start (not per-entity)
2451
+ * - Individual entity type permissions are NOT checked during cascade
2452
+ *
2453
+ * **Cascade Rules:**
2454
+ * - `collection` predicate NEVER cascades (hard rule - protects collection structure)
2455
+ * - Only entities in the specified collection are deleted
2456
+ * - Entities outside the collection are skipped (reported in `skipped` array)
2457
+ *
2458
+ * **Predicate Patterns:**
2459
+ * - `"child"` - exact match only
2460
+ * - `"has_*"` - matches has_document, has_image, etc.
2461
+ * - `"*_copy"` - matches file_copy, document_copy, etc.
2462
+ * - `"*"` - matches ALL predicates (except collection)
2463
+ *
2464
+ * **Traversal:**
2465
+ * - BFS traversal with parallel processing per depth layer
2466
+ * - Max depth: 20 (default: 10)
2467
+ * - Optional `edited_by_filter` to only delete entities created by a specific actor (useful for agent cleanup)
2468
+ *
2469
+ * **CAS Handling:**
2470
+ * - Root entity uses the provided `expect_tip`
2471
+ * - Child entities use re-fetch + single retry strategy
2472
+ * - CAS conflicts are reported as skipped (not failures)
2473
+ *
2474
+ * **Response:**
2475
+ * - Lists all deleted entities with their depth from root
2476
+ * - Lists skipped entities with reasons
2477
+ * - Provides summary statistics
2478
+ *
2479
+ * ---
2480
+ * **Permission:** `entity:delete`
2481
+ * **Auth:** required
2482
+ */
2483
+ delete: {
2484
+ parameters: {
2485
+ query?: never;
2486
+ header?: never;
2487
+ path: {
2488
+ /** @description Entity ID (ULID) */
2489
+ id: string;
2490
+ };
2491
+ cookie?: never;
2492
+ };
2493
+ requestBody?: {
2494
+ content: {
2495
+ "application/json": components["schemas"]["CascadeDeleteRequest"];
2496
+ };
2497
+ };
2498
+ responses: {
2499
+ /** @description Cascade delete completed */
2500
+ 200: {
2501
+ headers: {
2502
+ [name: string]: unknown;
2503
+ };
2504
+ content: {
2505
+ "application/json": components["schemas"]["CascadeDeleteResponse"];
2506
+ };
2507
+ };
2508
+ /** @description Bad Request - Invalid input */
2509
+ 400: {
2510
+ headers: {
2511
+ [name: string]: unknown;
2512
+ };
2513
+ content: {
2514
+ /**
2515
+ * @example {
2516
+ * "error": "Validation failed",
2517
+ * "details": {
2518
+ * "issues": [
2519
+ * {
2520
+ * "path": [
2521
+ * "properties",
2522
+ * "label"
2523
+ * ],
2524
+ * "message": "Required"
2525
+ * }
2526
+ * ]
2527
+ * }
2528
+ * }
2529
+ */
2530
+ "application/json": components["schemas"]["ValidationErrorResponse"];
2531
+ };
2532
+ };
2533
+ /** @description Unauthorized - Missing or invalid authentication */
2534
+ 401: {
2535
+ headers: {
2536
+ [name: string]: unknown;
2537
+ };
2538
+ content: {
2539
+ /**
2540
+ * @example {
2541
+ * "error": "Unauthorized: Missing or invalid authentication token"
2542
+ * }
2543
+ */
2544
+ "application/json": components["schemas"]["ErrorResponse"];
2545
+ };
2546
+ };
2547
+ /** @description Forbidden - Insufficient permissions */
2548
+ 403: {
2549
+ headers: {
2550
+ [name: string]: unknown;
2551
+ };
2552
+ content: {
2553
+ /**
2554
+ * @example {
2555
+ * "error": "Forbidden: You do not have permission to perform this action"
2556
+ * }
2557
+ */
2558
+ "application/json": components["schemas"]["ErrorResponse"];
2559
+ };
2560
+ };
2561
+ /** @description Not Found - Resource does not exist */
2562
+ 404: {
2563
+ headers: {
2564
+ [name: string]: unknown;
2565
+ };
2566
+ content: {
2567
+ /**
2568
+ * @example {
2569
+ * "error": "Entity not found"
2570
+ * }
2571
+ */
2572
+ "application/json": components["schemas"]["ErrorResponse"];
2573
+ };
2574
+ };
2575
+ /** @description Conflict - CAS validation failed (entity was modified) */
2576
+ 409: {
2577
+ headers: {
2578
+ [name: string]: unknown;
2579
+ };
2580
+ content: {
2581
+ /**
2582
+ * @example {
2583
+ * "error": "Conflict: entity was modified",
2584
+ * "details": {
2585
+ * "expected": "bafyreibug443cnd4endcwinwttw3c3dzmcl2ikht64xzn5qg56bix3usfy",
2586
+ * "actual": "bafyreinewabc123456789defghijklmnopqrstuvwxyz"
2587
+ * }
2588
+ * }
2589
+ */
2590
+ "application/json": components["schemas"]["CASErrorResponse"];
2591
+ };
2592
+ };
2593
+ };
2594
+ };
2595
+ options?: never;
2596
+ head?: never;
2597
+ patch?: never;
2598
+ trace?: never;
2599
+ };
2434
2600
  "/entities/{id}/restore": {
2435
2601
  parameters: {
2436
2602
  query?: never;
@@ -9101,6 +9267,110 @@ type components = {
9101
9267
  */
9102
9268
  reason?: string;
9103
9269
  };
9270
+ CascadeDeletedEntity: {
9271
+ /**
9272
+ * @description Entity ID (ULID format)
9273
+ * @example 01KDETYWYWM0MJVKM8DK3AEXPY
9274
+ */
9275
+ id: string;
9276
+ /**
9277
+ * @description Content Identifier (CID) - content-addressed hash
9278
+ * @example bafyreibug443cnd4endcwinwttw3c3dzmcl2ikht64xzn5qg56bix3usfy
9279
+ */
9280
+ cid: string;
9281
+ /**
9282
+ * @description Entity type
9283
+ * @example file
9284
+ */
9285
+ type: string;
9286
+ /**
9287
+ * @description Depth from root entity at which this entity was found
9288
+ * @example 1
9289
+ */
9290
+ depth: number;
9291
+ };
9292
+ CascadeSkippedEntity: {
9293
+ /**
9294
+ * @description Entity ID (ULID format)
9295
+ * @example 01KDETYWYWM0MJVKM8DK3AEXPY
9296
+ */
9297
+ id: string;
9298
+ /**
9299
+ * @description Entity type
9300
+ * @example file
9301
+ */
9302
+ type: string;
9303
+ /**
9304
+ * @description Reason an entity was skipped during cascade delete
9305
+ * @enum {string}
9306
+ */
9307
+ reason: "not_in_collection" | "already_deleted" | "edited_by_mismatch" | "cas_conflict";
9308
+ };
9309
+ CascadeDeleteResponse: {
9310
+ root: components["schemas"]["EntityDeletedResponse"] & unknown;
9311
+ /** @description Entities successfully deleted (ordered by depth, deepest first) */
9312
+ deleted: components["schemas"]["CascadeDeletedEntity"][];
9313
+ /** @description Entities skipped during traversal with reasons */
9314
+ skipped: components["schemas"]["CascadeSkippedEntity"][];
9315
+ /** @description Summary statistics for the cascade delete operation */
9316
+ summary: {
9317
+ /** @description Total entities visited during BFS traversal */
9318
+ total_traversed: number;
9319
+ /** @description Total entities successfully deleted (excluding root) */
9320
+ total_deleted: number;
9321
+ /** @description Total entities skipped during traversal */
9322
+ total_skipped: number;
9323
+ /** @description Maximum depth reached during traversal */
9324
+ max_depth_reached: number;
9325
+ };
9326
+ };
9327
+ CascadeDeleteRequest: {
9328
+ /**
9329
+ * @description Current tip CID for CAS validation. Request fails with 409 if this does not match.
9330
+ * @example bafyreibug443cnd4endcwinwttw3c3dzmcl2ikht64xzn5qg56bix3usfy
9331
+ */
9332
+ expect_tip: string;
9333
+ /**
9334
+ * @description Optional note describing this change
9335
+ * @example Added Chapter 42: The Whiteness of the Whale
9336
+ */
9337
+ note?: string;
9338
+ /**
9339
+ * @description Collection to scope the cascade delete. Only entities in this collection will be deleted. Permission check is performed on this collection.
9340
+ * @example 01KDETYWYWM0MJVKM8DK3AEXPY
9341
+ */
9342
+ collection_id: string;
9343
+ /**
9344
+ * @description Predicate patterns to follow during cascade traversal. Supports wildcards:
9345
+ * - `"child"` - exact match only
9346
+ * - `"has_*"` - matches has_document, has_image, etc.
9347
+ * - `"*_copy"` - matches file_copy, document_copy, etc.
9348
+ * - `"*"` - matches ALL predicates
9349
+ *
9350
+ * **Important:** The `collection` predicate NEVER cascades, even if `"*"` is specified. This protects the collection structure from accidental deletion.
9351
+ * @example [
9352
+ * "child",
9353
+ * "has_*"
9354
+ * ]
9355
+ */
9356
+ cascade_predicates: string[];
9357
+ /**
9358
+ * @description Only delete entities where edited_by.user_id matches this PI. Useful for cleaning up entities created by a specific agent.
9359
+ * @example 01KAGENTXXXXXXXXXXXXXXXX
9360
+ */
9361
+ edited_by_filter?: string;
9362
+ /**
9363
+ * @description Maximum relationship depth to traverse (default: 10, max: 20)
9364
+ * @default 10
9365
+ * @example 10
9366
+ */
9367
+ max_depth: number;
9368
+ /**
9369
+ * @description Reason for deleting the entities (applied to all deleted entities)
9370
+ * @example Cleanup after agent task
9371
+ */
9372
+ reason?: string;
9373
+ };
9104
9374
  EntityUpdateResponse: components["schemas"]["EntityResponse"] & {
9105
9375
  /**
9106
9376
  * @description Previous version CID
@@ -6,7 +6,7 @@
6
6
  *
7
7
  * Source: Arke v1 API
8
8
  * Version: 1.0.0
9
- * Generated: 2026-01-22T16:50:20.274Z
9
+ * Generated: 2026-01-22T18:25:50.170Z
10
10
  */
11
11
  type paths = {
12
12
  "/ops-reference": {
@@ -2431,6 +2431,172 @@ type paths = {
2431
2431
  patch?: never;
2432
2432
  trace?: never;
2433
2433
  };
2434
+ "/entities/{id}/cascade": {
2435
+ parameters: {
2436
+ query?: never;
2437
+ header?: never;
2438
+ path?: never;
2439
+ cookie?: never;
2440
+ };
2441
+ get?: never;
2442
+ put?: never;
2443
+ post?: never;
2444
+ /**
2445
+ * Cascade delete entity and related entities
2446
+ * @description Deletes an entity and all related entities matching predicate patterns within a scoped collection.
2447
+ *
2448
+ * **Permission Model:**
2449
+ * - Requires `entity:delete` permission on the specified `collection_id`
2450
+ * - Single permission check at the start (not per-entity)
2451
+ * - Individual entity type permissions are NOT checked during cascade
2452
+ *
2453
+ * **Cascade Rules:**
2454
+ * - `collection` predicate NEVER cascades (hard rule - protects collection structure)
2455
+ * - Only entities in the specified collection are deleted
2456
+ * - Entities outside the collection are skipped (reported in `skipped` array)
2457
+ *
2458
+ * **Predicate Patterns:**
2459
+ * - `"child"` - exact match only
2460
+ * - `"has_*"` - matches has_document, has_image, etc.
2461
+ * - `"*_copy"` - matches file_copy, document_copy, etc.
2462
+ * - `"*"` - matches ALL predicates (except collection)
2463
+ *
2464
+ * **Traversal:**
2465
+ * - BFS traversal with parallel processing per depth layer
2466
+ * - Max depth: 20 (default: 10)
2467
+ * - Optional `edited_by_filter` to only delete entities created by a specific actor (useful for agent cleanup)
2468
+ *
2469
+ * **CAS Handling:**
2470
+ * - Root entity uses the provided `expect_tip`
2471
+ * - Child entities use re-fetch + single retry strategy
2472
+ * - CAS conflicts are reported as skipped (not failures)
2473
+ *
2474
+ * **Response:**
2475
+ * - Lists all deleted entities with their depth from root
2476
+ * - Lists skipped entities with reasons
2477
+ * - Provides summary statistics
2478
+ *
2479
+ * ---
2480
+ * **Permission:** `entity:delete`
2481
+ * **Auth:** required
2482
+ */
2483
+ delete: {
2484
+ parameters: {
2485
+ query?: never;
2486
+ header?: never;
2487
+ path: {
2488
+ /** @description Entity ID (ULID) */
2489
+ id: string;
2490
+ };
2491
+ cookie?: never;
2492
+ };
2493
+ requestBody?: {
2494
+ content: {
2495
+ "application/json": components["schemas"]["CascadeDeleteRequest"];
2496
+ };
2497
+ };
2498
+ responses: {
2499
+ /** @description Cascade delete completed */
2500
+ 200: {
2501
+ headers: {
2502
+ [name: string]: unknown;
2503
+ };
2504
+ content: {
2505
+ "application/json": components["schemas"]["CascadeDeleteResponse"];
2506
+ };
2507
+ };
2508
+ /** @description Bad Request - Invalid input */
2509
+ 400: {
2510
+ headers: {
2511
+ [name: string]: unknown;
2512
+ };
2513
+ content: {
2514
+ /**
2515
+ * @example {
2516
+ * "error": "Validation failed",
2517
+ * "details": {
2518
+ * "issues": [
2519
+ * {
2520
+ * "path": [
2521
+ * "properties",
2522
+ * "label"
2523
+ * ],
2524
+ * "message": "Required"
2525
+ * }
2526
+ * ]
2527
+ * }
2528
+ * }
2529
+ */
2530
+ "application/json": components["schemas"]["ValidationErrorResponse"];
2531
+ };
2532
+ };
2533
+ /** @description Unauthorized - Missing or invalid authentication */
2534
+ 401: {
2535
+ headers: {
2536
+ [name: string]: unknown;
2537
+ };
2538
+ content: {
2539
+ /**
2540
+ * @example {
2541
+ * "error": "Unauthorized: Missing or invalid authentication token"
2542
+ * }
2543
+ */
2544
+ "application/json": components["schemas"]["ErrorResponse"];
2545
+ };
2546
+ };
2547
+ /** @description Forbidden - Insufficient permissions */
2548
+ 403: {
2549
+ headers: {
2550
+ [name: string]: unknown;
2551
+ };
2552
+ content: {
2553
+ /**
2554
+ * @example {
2555
+ * "error": "Forbidden: You do not have permission to perform this action"
2556
+ * }
2557
+ */
2558
+ "application/json": components["schemas"]["ErrorResponse"];
2559
+ };
2560
+ };
2561
+ /** @description Not Found - Resource does not exist */
2562
+ 404: {
2563
+ headers: {
2564
+ [name: string]: unknown;
2565
+ };
2566
+ content: {
2567
+ /**
2568
+ * @example {
2569
+ * "error": "Entity not found"
2570
+ * }
2571
+ */
2572
+ "application/json": components["schemas"]["ErrorResponse"];
2573
+ };
2574
+ };
2575
+ /** @description Conflict - CAS validation failed (entity was modified) */
2576
+ 409: {
2577
+ headers: {
2578
+ [name: string]: unknown;
2579
+ };
2580
+ content: {
2581
+ /**
2582
+ * @example {
2583
+ * "error": "Conflict: entity was modified",
2584
+ * "details": {
2585
+ * "expected": "bafyreibug443cnd4endcwinwttw3c3dzmcl2ikht64xzn5qg56bix3usfy",
2586
+ * "actual": "bafyreinewabc123456789defghijklmnopqrstuvwxyz"
2587
+ * }
2588
+ * }
2589
+ */
2590
+ "application/json": components["schemas"]["CASErrorResponse"];
2591
+ };
2592
+ };
2593
+ };
2594
+ };
2595
+ options?: never;
2596
+ head?: never;
2597
+ patch?: never;
2598
+ trace?: never;
2599
+ };
2434
2600
  "/entities/{id}/restore": {
2435
2601
  parameters: {
2436
2602
  query?: never;
@@ -9101,6 +9267,110 @@ type components = {
9101
9267
  */
9102
9268
  reason?: string;
9103
9269
  };
9270
+ CascadeDeletedEntity: {
9271
+ /**
9272
+ * @description Entity ID (ULID format)
9273
+ * @example 01KDETYWYWM0MJVKM8DK3AEXPY
9274
+ */
9275
+ id: string;
9276
+ /**
9277
+ * @description Content Identifier (CID) - content-addressed hash
9278
+ * @example bafyreibug443cnd4endcwinwttw3c3dzmcl2ikht64xzn5qg56bix3usfy
9279
+ */
9280
+ cid: string;
9281
+ /**
9282
+ * @description Entity type
9283
+ * @example file
9284
+ */
9285
+ type: string;
9286
+ /**
9287
+ * @description Depth from root entity at which this entity was found
9288
+ * @example 1
9289
+ */
9290
+ depth: number;
9291
+ };
9292
+ CascadeSkippedEntity: {
9293
+ /**
9294
+ * @description Entity ID (ULID format)
9295
+ * @example 01KDETYWYWM0MJVKM8DK3AEXPY
9296
+ */
9297
+ id: string;
9298
+ /**
9299
+ * @description Entity type
9300
+ * @example file
9301
+ */
9302
+ type: string;
9303
+ /**
9304
+ * @description Reason an entity was skipped during cascade delete
9305
+ * @enum {string}
9306
+ */
9307
+ reason: "not_in_collection" | "already_deleted" | "edited_by_mismatch" | "cas_conflict";
9308
+ };
9309
+ CascadeDeleteResponse: {
9310
+ root: components["schemas"]["EntityDeletedResponse"] & unknown;
9311
+ /** @description Entities successfully deleted (ordered by depth, deepest first) */
9312
+ deleted: components["schemas"]["CascadeDeletedEntity"][];
9313
+ /** @description Entities skipped during traversal with reasons */
9314
+ skipped: components["schemas"]["CascadeSkippedEntity"][];
9315
+ /** @description Summary statistics for the cascade delete operation */
9316
+ summary: {
9317
+ /** @description Total entities visited during BFS traversal */
9318
+ total_traversed: number;
9319
+ /** @description Total entities successfully deleted (excluding root) */
9320
+ total_deleted: number;
9321
+ /** @description Total entities skipped during traversal */
9322
+ total_skipped: number;
9323
+ /** @description Maximum depth reached during traversal */
9324
+ max_depth_reached: number;
9325
+ };
9326
+ };
9327
+ CascadeDeleteRequest: {
9328
+ /**
9329
+ * @description Current tip CID for CAS validation. Request fails with 409 if this does not match.
9330
+ * @example bafyreibug443cnd4endcwinwttw3c3dzmcl2ikht64xzn5qg56bix3usfy
9331
+ */
9332
+ expect_tip: string;
9333
+ /**
9334
+ * @description Optional note describing this change
9335
+ * @example Added Chapter 42: The Whiteness of the Whale
9336
+ */
9337
+ note?: string;
9338
+ /**
9339
+ * @description Collection to scope the cascade delete. Only entities in this collection will be deleted. Permission check is performed on this collection.
9340
+ * @example 01KDETYWYWM0MJVKM8DK3AEXPY
9341
+ */
9342
+ collection_id: string;
9343
+ /**
9344
+ * @description Predicate patterns to follow during cascade traversal. Supports wildcards:
9345
+ * - `"child"` - exact match only
9346
+ * - `"has_*"` - matches has_document, has_image, etc.
9347
+ * - `"*_copy"` - matches file_copy, document_copy, etc.
9348
+ * - `"*"` - matches ALL predicates
9349
+ *
9350
+ * **Important:** The `collection` predicate NEVER cascades, even if `"*"` is specified. This protects the collection structure from accidental deletion.
9351
+ * @example [
9352
+ * "child",
9353
+ * "has_*"
9354
+ * ]
9355
+ */
9356
+ cascade_predicates: string[];
9357
+ /**
9358
+ * @description Only delete entities where edited_by.user_id matches this PI. Useful for cleaning up entities created by a specific agent.
9359
+ * @example 01KAGENTXXXXXXXXXXXXXXXX
9360
+ */
9361
+ edited_by_filter?: string;
9362
+ /**
9363
+ * @description Maximum relationship depth to traverse (default: 10, max: 20)
9364
+ * @default 10
9365
+ * @example 10
9366
+ */
9367
+ max_depth: number;
9368
+ /**
9369
+ * @description Reason for deleting the entities (applied to all deleted entities)
9370
+ * @example Cleanup after agent task
9371
+ */
9372
+ reason?: string;
9373
+ };
9104
9374
  EntityUpdateResponse: components["schemas"]["EntityResponse"] & {
9105
9375
  /**
9106
9376
  * @description Previous version CID
package/openapi/spec.json CHANGED
@@ -2216,6 +2216,193 @@
2216
2216
  "expect_tip"
2217
2217
  ]
2218
2218
  },
2219
+ "CascadeDeletedEntity": {
2220
+ "type": "object",
2221
+ "properties": {
2222
+ "id": {
2223
+ "type": "string",
2224
+ "pattern": "^(?:II[0-9A-HJKMNP-TV-Z]{24}|[FC][0-9A-HJKMNP-TV-Z]{25}|[0-9A-HJKMNP-TV-Z]{26})$",
2225
+ "description": "Entity ID (ULID format)",
2226
+ "example": "01KDETYWYWM0MJVKM8DK3AEXPY"
2227
+ },
2228
+ "cid": {
2229
+ "type": "string",
2230
+ "minLength": 1,
2231
+ "description": "Content Identifier (CID) - content-addressed hash",
2232
+ "example": "bafyreibug443cnd4endcwinwttw3c3dzmcl2ikht64xzn5qg56bix3usfy"
2233
+ },
2234
+ "type": {
2235
+ "type": "string",
2236
+ "description": "Entity type",
2237
+ "example": "file"
2238
+ },
2239
+ "depth": {
2240
+ "type": "integer",
2241
+ "description": "Depth from root entity at which this entity was found",
2242
+ "example": 1
2243
+ }
2244
+ },
2245
+ "required": [
2246
+ "id",
2247
+ "cid",
2248
+ "type",
2249
+ "depth"
2250
+ ]
2251
+ },
2252
+ "CascadeSkippedEntity": {
2253
+ "type": "object",
2254
+ "properties": {
2255
+ "id": {
2256
+ "type": "string",
2257
+ "pattern": "^(?:II[0-9A-HJKMNP-TV-Z]{24}|[FC][0-9A-HJKMNP-TV-Z]{25}|[0-9A-HJKMNP-TV-Z]{26})$",
2258
+ "description": "Entity ID (ULID format)",
2259
+ "example": "01KDETYWYWM0MJVKM8DK3AEXPY"
2260
+ },
2261
+ "type": {
2262
+ "type": "string",
2263
+ "description": "Entity type",
2264
+ "example": "file"
2265
+ },
2266
+ "reason": {
2267
+ "type": "string",
2268
+ "enum": [
2269
+ "not_in_collection",
2270
+ "already_deleted",
2271
+ "edited_by_mismatch",
2272
+ "cas_conflict"
2273
+ ],
2274
+ "description": "Reason an entity was skipped during cascade delete"
2275
+ }
2276
+ },
2277
+ "required": [
2278
+ "id",
2279
+ "type",
2280
+ "reason"
2281
+ ]
2282
+ },
2283
+ "CascadeDeleteResponse": {
2284
+ "type": "object",
2285
+ "properties": {
2286
+ "root": {
2287
+ "allOf": [
2288
+ {
2289
+ "$ref": "#/components/schemas/EntityDeletedResponse"
2290
+ },
2291
+ {
2292
+ "description": "Deletion result for the root entity"
2293
+ }
2294
+ ]
2295
+ },
2296
+ "deleted": {
2297
+ "type": "array",
2298
+ "items": {
2299
+ "$ref": "#/components/schemas/CascadeDeletedEntity"
2300
+ },
2301
+ "description": "Entities successfully deleted (ordered by depth, deepest first)"
2302
+ },
2303
+ "skipped": {
2304
+ "type": "array",
2305
+ "items": {
2306
+ "$ref": "#/components/schemas/CascadeSkippedEntity"
2307
+ },
2308
+ "description": "Entities skipped during traversal with reasons"
2309
+ },
2310
+ "summary": {
2311
+ "type": "object",
2312
+ "properties": {
2313
+ "total_traversed": {
2314
+ "type": "integer",
2315
+ "description": "Total entities visited during BFS traversal"
2316
+ },
2317
+ "total_deleted": {
2318
+ "type": "integer",
2319
+ "description": "Total entities successfully deleted (excluding root)"
2320
+ },
2321
+ "total_skipped": {
2322
+ "type": "integer",
2323
+ "description": "Total entities skipped during traversal"
2324
+ },
2325
+ "max_depth_reached": {
2326
+ "type": "integer",
2327
+ "description": "Maximum depth reached during traversal"
2328
+ }
2329
+ },
2330
+ "required": [
2331
+ "total_traversed",
2332
+ "total_deleted",
2333
+ "total_skipped",
2334
+ "max_depth_reached"
2335
+ ],
2336
+ "description": "Summary statistics for the cascade delete operation"
2337
+ }
2338
+ },
2339
+ "required": [
2340
+ "root",
2341
+ "deleted",
2342
+ "skipped",
2343
+ "summary"
2344
+ ]
2345
+ },
2346
+ "CascadeDeleteRequest": {
2347
+ "type": "object",
2348
+ "properties": {
2349
+ "expect_tip": {
2350
+ "type": "string",
2351
+ "minLength": 1,
2352
+ "description": "Current tip CID for CAS validation. Request fails with 409 if this does not match.",
2353
+ "example": "bafyreibug443cnd4endcwinwttw3c3dzmcl2ikht64xzn5qg56bix3usfy"
2354
+ },
2355
+ "note": {
2356
+ "type": "string",
2357
+ "description": "Optional note describing this change",
2358
+ "example": "Added Chapter 42: The Whiteness of the Whale"
2359
+ },
2360
+ "collection_id": {
2361
+ "type": "string",
2362
+ "pattern": "^(?:II[0-9A-HJKMNP-TV-Z]{24}|[FC][0-9A-HJKMNP-TV-Z]{25}|[0-9A-HJKMNP-TV-Z]{26})$",
2363
+ "description": "Collection to scope the cascade delete. Only entities in this collection will be deleted. Permission check is performed on this collection.",
2364
+ "example": "01KDETYWYWM0MJVKM8DK3AEXPY"
2365
+ },
2366
+ "cascade_predicates": {
2367
+ "type": "array",
2368
+ "items": {
2369
+ "type": "string",
2370
+ "minLength": 1
2371
+ },
2372
+ "minItems": 1,
2373
+ "description": "Predicate patterns to follow during cascade traversal. Supports wildcards:\n- `\"child\"` - exact match only\n- `\"has_*\"` - matches has_document, has_image, etc.\n- `\"*_copy\"` - matches file_copy, document_copy, etc.\n- `\"*\"` - matches ALL predicates\n\n**Important:** The `collection` predicate NEVER cascades, even if `\"*\"` is specified. This protects the collection structure from accidental deletion.",
2374
+ "example": [
2375
+ "child",
2376
+ "has_*"
2377
+ ]
2378
+ },
2379
+ "edited_by_filter": {
2380
+ "type": "string",
2381
+ "pattern": "^(?:II[0-9A-HJKMNP-TV-Z]{24}|[FC][0-9A-HJKMNP-TV-Z]{25}|[0-9A-HJKMNP-TV-Z]{26})$",
2382
+ "description": "Only delete entities where edited_by.user_id matches this PI. Useful for cleaning up entities created by a specific agent.",
2383
+ "example": "01KAGENTXXXXXXXXXXXXXXXX"
2384
+ },
2385
+ "max_depth": {
2386
+ "type": "integer",
2387
+ "minimum": 1,
2388
+ "maximum": 20,
2389
+ "default": 10,
2390
+ "description": "Maximum relationship depth to traverse (default: 10, max: 20)",
2391
+ "example": 10
2392
+ },
2393
+ "reason": {
2394
+ "type": "string",
2395
+ "maxLength": 500,
2396
+ "description": "Reason for deleting the entities (applied to all deleted entities)",
2397
+ "example": "Cleanup after agent task"
2398
+ }
2399
+ },
2400
+ "required": [
2401
+ "expect_tip",
2402
+ "collection_id",
2403
+ "cascade_predicates"
2404
+ ]
2405
+ },
2219
2406
  "EntityUpdateResponse": {
2220
2407
  "allOf": [
2221
2408
  {
@@ -9343,6 +9530,138 @@
9343
9530
  }
9344
9531
  }
9345
9532
  },
9533
+ "/entities/{id}/cascade": {
9534
+ "delete": {
9535
+ "tags": [
9536
+ "Entities"
9537
+ ],
9538
+ "summary": "Cascade delete entity and related entities",
9539
+ "description": "Deletes an entity and all related entities matching predicate patterns within a scoped collection.\n\n**Permission Model:**\n- Requires `entity:delete` permission on the specified `collection_id`\n- Single permission check at the start (not per-entity)\n- Individual entity type permissions are NOT checked during cascade\n\n**Cascade Rules:**\n- `collection` predicate NEVER cascades (hard rule - protects collection structure)\n- Only entities in the specified collection are deleted\n- Entities outside the collection are skipped (reported in `skipped` array)\n\n**Predicate Patterns:**\n- `\"child\"` - exact match only\n- `\"has_*\"` - matches has_document, has_image, etc.\n- `\"*_copy\"` - matches file_copy, document_copy, etc.\n- `\"*\"` - matches ALL predicates (except collection)\n\n**Traversal:**\n- BFS traversal with parallel processing per depth layer\n- Max depth: 20 (default: 10)\n- Optional `edited_by_filter` to only delete entities created by a specific actor (useful for agent cleanup)\n\n**CAS Handling:**\n- Root entity uses the provided `expect_tip`\n- Child entities use re-fetch + single retry strategy\n- CAS conflicts are reported as skipped (not failures)\n\n**Response:**\n- Lists all deleted entities with their depth from root\n- Lists skipped entities with reasons\n- Provides summary statistics\n\n---\n**Permission:** `entity:delete` \n**Auth:** required",
9540
+ "x-arke-action": "entity:delete",
9541
+ "x-arke-auth": "required",
9542
+ "x-arke-tier": "standard",
9543
+ "security": [
9544
+ {
9545
+ "bearerAuth": []
9546
+ }
9547
+ ],
9548
+ "parameters": [
9549
+ {
9550
+ "schema": {
9551
+ "type": "string",
9552
+ "pattern": "^(?:II[0-9A-HJKMNP-TV-Z]{24}|[FC][0-9A-HJKMNP-TV-Z]{25}|[0-9A-HJKMNP-TV-Z]{26})$",
9553
+ "description": "Entity ID (ULID format)",
9554
+ "example": "01KDETYWYWM0MJVKM8DK3AEXPY"
9555
+ },
9556
+ "required": true,
9557
+ "description": "Entity ID (ULID)",
9558
+ "name": "id",
9559
+ "in": "path"
9560
+ }
9561
+ ],
9562
+ "requestBody": {
9563
+ "content": {
9564
+ "application/json": {
9565
+ "schema": {
9566
+ "$ref": "#/components/schemas/CascadeDeleteRequest"
9567
+ }
9568
+ }
9569
+ }
9570
+ },
9571
+ "responses": {
9572
+ "200": {
9573
+ "description": "Cascade delete completed",
9574
+ "content": {
9575
+ "application/json": {
9576
+ "schema": {
9577
+ "$ref": "#/components/schemas/CascadeDeleteResponse"
9578
+ }
9579
+ }
9580
+ }
9581
+ },
9582
+ "400": {
9583
+ "description": "Bad Request - Invalid input",
9584
+ "content": {
9585
+ "application/json": {
9586
+ "schema": {
9587
+ "$ref": "#/components/schemas/ValidationErrorResponse"
9588
+ },
9589
+ "example": {
9590
+ "error": "Validation failed",
9591
+ "details": {
9592
+ "issues": [
9593
+ {
9594
+ "path": [
9595
+ "properties",
9596
+ "label"
9597
+ ],
9598
+ "message": "Required"
9599
+ }
9600
+ ]
9601
+ }
9602
+ }
9603
+ }
9604
+ }
9605
+ },
9606
+ "401": {
9607
+ "description": "Unauthorized - Missing or invalid authentication",
9608
+ "content": {
9609
+ "application/json": {
9610
+ "schema": {
9611
+ "$ref": "#/components/schemas/ErrorResponse"
9612
+ },
9613
+ "example": {
9614
+ "error": "Unauthorized: Missing or invalid authentication token"
9615
+ }
9616
+ }
9617
+ }
9618
+ },
9619
+ "403": {
9620
+ "description": "Forbidden - Insufficient permissions",
9621
+ "content": {
9622
+ "application/json": {
9623
+ "schema": {
9624
+ "$ref": "#/components/schemas/ErrorResponse"
9625
+ },
9626
+ "example": {
9627
+ "error": "Forbidden: You do not have permission to perform this action"
9628
+ }
9629
+ }
9630
+ }
9631
+ },
9632
+ "404": {
9633
+ "description": "Not Found - Resource does not exist",
9634
+ "content": {
9635
+ "application/json": {
9636
+ "schema": {
9637
+ "$ref": "#/components/schemas/ErrorResponse"
9638
+ },
9639
+ "example": {
9640
+ "error": "Entity not found"
9641
+ }
9642
+ }
9643
+ }
9644
+ },
9645
+ "409": {
9646
+ "description": "Conflict - CAS validation failed (entity was modified)",
9647
+ "content": {
9648
+ "application/json": {
9649
+ "schema": {
9650
+ "$ref": "#/components/schemas/CASErrorResponse"
9651
+ },
9652
+ "example": {
9653
+ "error": "Conflict: entity was modified",
9654
+ "details": {
9655
+ "expected": "bafyreibug443cnd4endcwinwttw3c3dzmcl2ikht64xzn5qg56bix3usfy",
9656
+ "actual": "bafyreinewabc123456789defghijklmnopqrstuvwxyz"
9657
+ }
9658
+ }
9659
+ }
9660
+ }
9661
+ }
9662
+ }
9663
+ }
9664
+ },
9346
9665
  "/entities/{id}/restore": {
9347
9666
  "post": {
9348
9667
  "tags": [
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "specVersion": "1.0.0",
3
3
  "apiVersion": "1.0.0",
4
- "fetchedAt": "2026-01-22T16:50:19.354Z",
4
+ "fetchedAt": "2026-01-22T18:25:48.982Z",
5
5
  "sourceUrl": "https://arke-v1.arke.institute/openapi.json",
6
6
  "openApiVersion": "3.1.0"
7
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arke-institute/sdk",
3
- "version": "2.3.13",
3
+ "version": "2.3.14",
4
4
  "description": "TypeScript SDK for the Arke API - auto-generated from OpenAPI spec",
5
5
  "type": "module",
6
6
  "main": "dist/index.cjs",