@warmhub/cli 0.84.3 → 0.85.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.
Files changed (2) hide show
  1. package/dist/wh.js +509 -426
  2. package/package.json +1 -1
package/dist/wh.js CHANGED
@@ -4092,11 +4092,11 @@ var require_util2 = __commonJS((exports, module) => {
4092
4092
  var { isUint8Array } = __require("node:util/types");
4093
4093
  var { webidl } = require_webidl();
4094
4094
  var supportedHashes = [];
4095
- var crypto2;
4095
+ var crypto;
4096
4096
  try {
4097
- crypto2 = __require("node:crypto");
4097
+ crypto = __require("node:crypto");
4098
4098
  const possibleRelevantHashes = ["sha256", "sha384", "sha512"];
4099
- supportedHashes = crypto2.getHashes().filter((hash) => possibleRelevantHashes.includes(hash));
4099
+ supportedHashes = crypto.getHashes().filter((hash) => possibleRelevantHashes.includes(hash));
4100
4100
  } catch {}
4101
4101
  function responseURL(response) {
4102
4102
  const urlList = response.urlList;
@@ -4355,7 +4355,7 @@ var require_util2 = __commonJS((exports, module) => {
4355
4355
  }
4356
4356
  }
4357
4357
  function bytesMatch(bytes, metadataList) {
4358
- if (crypto2 === undefined) {
4358
+ if (crypto === undefined) {
4359
4359
  return true;
4360
4360
  }
4361
4361
  const parsedMetadata = parseMetadata(metadataList);
@@ -4370,7 +4370,7 @@ var require_util2 = __commonJS((exports, module) => {
4370
4370
  for (const item of metadata) {
4371
4371
  const algorithm = item.algo;
4372
4372
  const expectedValue = item.hash;
4373
- let actualValue = crypto2.createHash(algorithm).update(bytes).digest("base64");
4373
+ let actualValue = crypto.createHash(algorithm).update(bytes).digest("base64");
4374
4374
  if (actualValue[actualValue.length - 1] === "=") {
4375
4375
  if (actualValue[actualValue.length - 2] === "=") {
4376
4376
  actualValue = actualValue.slice(0, -2);
@@ -5355,8 +5355,8 @@ var require_body = __commonJS((exports, module) => {
5355
5355
  var { multipartFormDataParser } = require_formdata_parser();
5356
5356
  var random;
5357
5357
  try {
5358
- const crypto2 = __require("node:crypto");
5359
- random = (max) => crypto2.randomInt(0, max);
5358
+ const crypto = __require("node:crypto");
5359
+ random = (max) => crypto.randomInt(0, max);
5360
5360
  } catch {
5361
5361
  random = (max) => Math.floor(Math.random(max));
5362
5362
  }
@@ -16107,13 +16107,13 @@ var require_util7 = __commonJS((exports, module) => {
16107
16107
  var require_frame = __commonJS((exports, module) => {
16108
16108
  var { maxUnsigned16Bit } = require_constants5();
16109
16109
  var BUFFER_SIZE = 16386;
16110
- var crypto2;
16110
+ var crypto;
16111
16111
  var buffer = null;
16112
16112
  var bufIdx = BUFFER_SIZE;
16113
16113
  try {
16114
- crypto2 = __require("node:crypto");
16114
+ crypto = __require("node:crypto");
16115
16115
  } catch {
16116
- crypto2 = {
16116
+ crypto = {
16117
16117
  randomFillSync: function randomFillSync(buffer2, _offset, _size) {
16118
16118
  for (let i = 0;i < buffer2.length; ++i) {
16119
16119
  buffer2[i] = Math.random() * 255 | 0;
@@ -16125,7 +16125,7 @@ var require_frame = __commonJS((exports, module) => {
16125
16125
  function generateMask() {
16126
16126
  if (bufIdx === BUFFER_SIZE) {
16127
16127
  bufIdx = 0;
16128
- crypto2.randomFillSync(buffer ??= Buffer.allocUnsafe(BUFFER_SIZE), 0, BUFFER_SIZE);
16128
+ crypto.randomFillSync(buffer ??= Buffer.allocUnsafe(BUFFER_SIZE), 0, BUFFER_SIZE);
16129
16129
  }
16130
16130
  return [buffer[bufIdx++], buffer[bufIdx++], buffer[bufIdx++], buffer[bufIdx++]];
16131
16131
  }
@@ -16193,9 +16193,9 @@ var require_connection = __commonJS((exports, module) => {
16193
16193
  var { Headers: Headers2, getHeadersList } = require_headers();
16194
16194
  var { getDecodeSplit } = require_util2();
16195
16195
  var { WebsocketFrameSend } = require_frame();
16196
- var crypto2;
16196
+ var crypto;
16197
16197
  try {
16198
- crypto2 = __require("node:crypto");
16198
+ crypto = __require("node:crypto");
16199
16199
  } catch {}
16200
16200
  function establishWebSocketConnection(url, protocols, client, ws, onEstablish, options) {
16201
16201
  const requestURL = url;
@@ -16214,7 +16214,7 @@ var require_connection = __commonJS((exports, module) => {
16214
16214
  const headersList = getHeadersList(new Headers2(options.headers));
16215
16215
  request.headersList = headersList;
16216
16216
  }
16217
- const keyValue = crypto2.randomBytes(16).toString("base64");
16217
+ const keyValue = crypto.randomBytes(16).toString("base64");
16218
16218
  request.headersList.append("sec-websocket-key", keyValue);
16219
16219
  request.headersList.append("sec-websocket-version", "13");
16220
16220
  for (const protocol of protocols) {
@@ -16244,7 +16244,7 @@ var require_connection = __commonJS((exports, module) => {
16244
16244
  return;
16245
16245
  }
16246
16246
  const secWSAccept = response.headersList.get("Sec-WebSocket-Accept");
16247
- const digest2 = crypto2.createHash("sha1").update(keyValue + uid).digest("base64");
16247
+ const digest2 = crypto.createHash("sha1").update(keyValue + uid).digest("base64");
16248
16248
  if (secWSAccept !== digest2) {
16249
16249
  failWebsocketConnection(ws, "Incorrect hash received in Sec-WebSocket-Accept header.");
16250
16250
  return;
@@ -19146,31 +19146,6 @@ var import_usingCtx = __toESM(require_usingCtx(), 1);
19146
19146
  var import_awaitAsyncGenerator = __toESM(require_awaitAsyncGenerator(), 1);
19147
19147
  var import_wrapAsyncGenerator = __toESM(require_wrapAsyncGenerator(), 1);
19148
19148
  var import_objectSpread29 = __toESM(require_objectSpread2(), 1);
19149
- // ../../packages/rules/src/authority-coverage.ts
19150
- var EMPTY_COVERAGE = Object.freeze({
19151
- include: Object.freeze([])
19152
- });
19153
- var FULL_REPO_COVERAGE = Object.freeze({
19154
- include: Object.freeze(["**"])
19155
- });
19156
- var EMPTY_COVERAGE_SET = Object.freeze([]);
19157
- var FULL_REPO_COVERAGE_SET = Object.freeze([
19158
- Object.freeze([FULL_REPO_COVERAGE])
19159
- ]);
19160
- // ../../packages/rules/src/stable-json.ts
19161
- function stableJson(value) {
19162
- if (!value || typeof value !== "object") {
19163
- return JSON.stringify(value);
19164
- }
19165
- if (Array.isArray(value)) {
19166
- return `[${value.map((entry) => stableJson(entry)).join(",")}]`;
19167
- }
19168
- const record = value;
19169
- return `{${Object.keys(record).sort().map((key) => `${JSON.stringify(key)}:${stableJson(record[key])}`).join(",")}}`;
19170
- }
19171
- function stableJsonEquals(left, right) {
19172
- return stableJson(left) === stableJson(right);
19173
- }
19174
19149
  // ../../packages/rules/src/builtin-shapes.ts
19175
19150
  var BUILTIN_SHAPE_NAMES = [
19176
19151
  "Arc",
@@ -19399,6 +19374,21 @@ function resolveComponentTemplate(value, ctx) {
19399
19374
  });
19400
19375
  }
19401
19376
 
19377
+ // ../../packages/rules/src/stable-json.ts
19378
+ function stableJson(value) {
19379
+ if (!value || typeof value !== "object") {
19380
+ return JSON.stringify(value);
19381
+ }
19382
+ if (Array.isArray(value)) {
19383
+ return `[${value.map((entry) => stableJson(entry)).join(",")}]`;
19384
+ }
19385
+ const record = value;
19386
+ return `{${Object.keys(record).sort().map((key) => `${JSON.stringify(key)}:${stableJson(record[key])}`).join(",")}}`;
19387
+ }
19388
+ function stableJsonEquals(left, right) {
19389
+ return stableJson(left) === stableJson(right);
19390
+ }
19391
+
19402
19392
  // ../../packages/rules/src/org-activity-events.ts
19403
19393
  var ORG_MEMBER_ADDED_EVENT_TYPE = "org.member_added";
19404
19394
  var ORG_REPO_CREATED_EVENT_TYPE = "org.repo_created";
@@ -20410,7 +20400,304 @@ function joinFieldIdentityPath(...segments) {
20410
20400
  function joinFieldPathWithEscaper(escapeSegment, segments) {
20411
20401
  return segments.map((segment) => typeof segment === "number" ? `[${segment}]` : escapeSegment(segment)).join(".").replace(/\.\[/g, "[");
20412
20402
  }
20403
+ // ../../packages/rules/src/tokens.ts
20404
+ var COMMIT_TOKEN_SYNTAX_REMOVED_MESSAGE = "$N/#N commit-token syntax is no longer supported. Use explicit names and explicit wrefs. For assertions about newly created things, create the thing with a deterministic name and set about to that wref in the same commit.";
20405
+ var ANY_TOKEN_RE = /[$#]\d+/;
20406
+ function hasAnyTokens(s) {
20407
+ return ANY_TOKEN_RE.test(s);
20408
+ }
20413
20409
 
20410
+ // ../../packages/rules/src/preflight-commit.ts
20411
+ function preflightCommitDiagnostics(operations, options) {
20412
+ const errors = [];
20413
+ rejectCommitTokenSyntax(operations, errors, options);
20414
+ illegalOpSequences(operations, errors, options?.checkAddAdd ?? true, options);
20415
+ return errors;
20416
+ }
20417
+ function sourceOperationIndex(filteredIndex, options) {
20418
+ return options?.sourceOperationIndexes?.[filteredIndex] ?? filteredIndex;
20419
+ }
20420
+ function getOpName(op) {
20421
+ return op.name;
20422
+ }
20423
+ function tokenStringFields(op) {
20424
+ const fields = [getOpName(op), op.newName];
20425
+ if (typeof op.about === "string") {
20426
+ fields.push(op.about);
20427
+ }
20428
+ if (op.members) {
20429
+ fields.push(...op.members);
20430
+ }
20431
+ return fields;
20432
+ }
20433
+ function rejectCommitTokenSyntax(operations, errors, options) {
20434
+ for (let i = 0;i < operations.length; i++) {
20435
+ const op = operations[i];
20436
+ if (!op)
20437
+ continue;
20438
+ for (const field of tokenStringFields(op)) {
20439
+ if (field && hasAnyTokens(field)) {
20440
+ errors.push({
20441
+ code: "COMMIT_TOKEN_SYNTAX_REMOVED",
20442
+ operationIndex: sourceOperationIndex(i, options),
20443
+ message: COMMIT_TOKEN_SYNTAX_REMOVED_MESSAGE
20444
+ });
20445
+ break;
20446
+ }
20447
+ }
20448
+ }
20449
+ }
20450
+ function illegalOpSequences(operations, errors, checkAddAdd, options) {
20451
+ const opHistory = new Map;
20452
+ for (let i = 0;i < operations.length; i++) {
20453
+ const op = operations[i];
20454
+ if (!op)
20455
+ continue;
20456
+ const name = getOpName(op);
20457
+ if (!name)
20458
+ continue;
20459
+ if (hasAnyTokens(name))
20460
+ continue;
20461
+ const kind = inferOperationKind({ ...op, name });
20462
+ const qualName = kind === "shape" ? `shape:${name}` : `thing:${name}`;
20463
+ const history = opHistory.get(qualName) ?? [];
20464
+ history.push({
20465
+ operation: op.operation,
20466
+ index: sourceOperationIndex(i, options)
20467
+ });
20468
+ opHistory.set(qualName, history);
20469
+ }
20470
+ for (const [qualName, history] of opHistory) {
20471
+ if (history.length < 2)
20472
+ continue;
20473
+ for (let i = 1;i < history.length; i++) {
20474
+ const prev = history[i - 1];
20475
+ const curr = history[i];
20476
+ if (!prev || !curr)
20477
+ continue;
20478
+ const pair = `${prev.operation}+${curr.operation}`;
20479
+ if (checkAddAdd && pair === "add+add") {
20480
+ errors.push({
20481
+ code: "ILLEGAL_OP_SEQUENCE",
20482
+ operationIndex: curr.index,
20483
+ message: `Cannot add "${qualName}" twice in the same commit`
20484
+ });
20485
+ }
20486
+ if (pair === "revise+add") {
20487
+ errors.push({
20488
+ code: "ILLEGAL_OP_SEQUENCE",
20489
+ operationIndex: curr.index,
20490
+ message: `Cannot revise then add "${qualName}" in the same commit`
20491
+ });
20492
+ }
20493
+ }
20494
+ }
20495
+ }
20496
+
20497
+ // ../../packages/rules/src/preflight-operation.ts
20498
+ var collectionTypes = ["arc", "bond", "set", "list", "pair"];
20499
+ var canonicalCollectionTypes = ["arc", "bond", "set", "list"];
20500
+ var collectionOps = ["add", "revise"];
20501
+ var COLLECTION_CREATE_REQUIRES_NAME_MESSAGE = "Collection create requires a name. Collections are ordinary named things (ADR 0004).";
20502
+ var COLLECTION_ABOUT_REMOVED_MESSAGE = 'about accepts a wref. Create the collection as its own named operation, then point the assertion at it. Prefer deterministic relationship names, for example: [{"operation":"add","kind":"collection","type":"arc","name":"a-to-b","members":["A","B"]},{"operation":"add","kind":"assertion","about":"Arc/a-to-b","name":"Assertion/example","data":{}}]. For CLI usage, use wh commit submit --file with the two operations.';
20503
+ function preflightOpDiagnostics(op, operationIndex) {
20504
+ const errors = [];
20505
+ errors.push(...builtinShapeGuard(op, operationIndex));
20506
+ errors.push(...contentNameGuard(op, operationIndex));
20507
+ errors.push(...plusSignGuard(op, operationIndex));
20508
+ errors.push(...validateCollectionAbouts(op, operationIndex));
20509
+ errors.push(...validateCollectionOps(op, operationIndex));
20510
+ return errors;
20511
+ }
20512
+ function builtinShapeGuard(op, operationIndex) {
20513
+ const errors = [];
20514
+ const name = op.name;
20515
+ const isShapeRename = op.operation === "rename" && (op.kind === "shape" || op.name !== undefined && !splitLocalPath(op.name));
20516
+ const reservedSourcePassThrough = isShapeRename && name !== undefined && isRenameableSquattedShape(name) && op.newName !== undefined && !isReservedCollectionShape(op.newName) && !isBuiltinShape(op.newName);
20517
+ if (name && isRetiredCollectionShape(name) && !reservedSourcePassThrough) {
20518
+ errors.push({
20519
+ code: "RESERVED_NAME",
20520
+ operationIndex,
20521
+ message: `Shape "${name}" is a retired collection shape and cannot be written manually`
20522
+ });
20523
+ }
20524
+ if (op.operation === "rename" && (op.kind === "shape" || op.name !== undefined && !splitLocalPath(op.name)) && op.newName && isRetiredCollectionShape(op.newName)) {
20525
+ errors.push({
20526
+ code: "RESERVED_NAME",
20527
+ operationIndex,
20528
+ message: `Shape "${op.newName}" is a retired collection shape and cannot be written manually`
20529
+ });
20530
+ } else {
20531
+ const builtinShapeName = name && isBuiltinShape(name) && !reservedSourcePassThrough ? name : isShapeRename && op.newName && isBuiltinShape(op.newName) ? op.newName : undefined;
20532
+ if (builtinShapeName && (isShapeRename || op.operation !== "retract" && op.kind === "shape")) {
20533
+ const action = op.operation === "add" ? "created" : op.operation === "rename" ? "renamed" : "revised";
20534
+ errors.push({
20535
+ code: "RESERVED_NAME",
20536
+ operationIndex,
20537
+ message: `Shape "${builtinShapeName}" is a built-in shape and cannot be ${action} manually`
20538
+ });
20539
+ }
20540
+ }
20541
+ if (name) {
20542
+ const local = splitLocalPath(name);
20543
+ if (local && isRetiredCollectionShape(local.shapePrefix)) {
20544
+ errors.push({
20545
+ code: "VALIDATION_ERROR",
20546
+ operationIndex,
20547
+ message: `Cannot ${op.operation} under retired collection shape "${local.shapePrefix}". Triple is read-only and retired for new collection writes.`
20548
+ });
20549
+ } else if (op.kind === "thing" && local && isBuiltinCollectionShape(local.shapePrefix)) {
20550
+ const message = op.operation === "add" ? `Cannot add kind="thing" under built-in shape "${local.shapePrefix}". Use kind="collection" instead.` : `Cannot revise kind="thing" under built-in shape "${local.shapePrefix}". Use kind="collection" to revise a collection.`;
20551
+ errors.push({
20552
+ code: "VALIDATION_ERROR",
20553
+ operationIndex,
20554
+ message
20555
+ });
20556
+ }
20557
+ }
20558
+ return errors;
20559
+ }
20560
+ function contentNameGuard(op, operationIndex) {
20561
+ if (op.kind !== "thing" || !op.name)
20562
+ return [];
20563
+ const local = splitLocalPath(op.name);
20564
+ if (!local || !isContentShape(local.shapePrefix))
20565
+ return [];
20566
+ const bareName = local.bareName;
20567
+ if (isSynthesizedContentName(bareName)) {
20568
+ return [
20569
+ {
20570
+ code: "READ_ONLY_BUILTIN_CONTENT",
20571
+ operationIndex,
20572
+ message: `${local.shapePrefix}/${bareName} is synthesized; writes are not allowed`
20573
+ }
20574
+ ];
20575
+ }
20576
+ if (!isStoredContentName(bareName)) {
20577
+ return [
20578
+ {
20579
+ code: "UNKNOWN_CONTENT_NAME",
20580
+ operationIndex,
20581
+ message: `${local.shapePrefix}/${bareName} is not a recognized well-known content name`
20582
+ }
20583
+ ];
20584
+ }
20585
+ return [];
20586
+ }
20587
+ function plusSignGuard(op, operationIndex) {
20588
+ const errors = [];
20589
+ const name = op.name;
20590
+ if (op.newName?.includes("+")) {
20591
+ errors.push({
20592
+ code: "VALIDATION_ERROR",
20593
+ operationIndex,
20594
+ message: `Name "${op.newName}" contains reserved character "+". The "+" character is reserved for the historical collection auto-name namespace and is not allowed in user-supplied names.`
20595
+ });
20596
+ return errors;
20597
+ }
20598
+ if (name?.includes("+")) {
20599
+ if (op.kind === "collection" && op.operation === "add") {
20600
+ errors.push({
20601
+ code: "VALIDATION_ERROR",
20602
+ operationIndex,
20603
+ message: `Name "${name}" contains reserved character "+". The "+" character is reserved for the historical collection auto-name namespace and is not allowed in user-supplied names.`
20604
+ });
20605
+ return errors;
20606
+ }
20607
+ if (op.kind === "collection")
20608
+ return errors;
20609
+ const local = splitLocalPath(name);
20610
+ if (local && isReservedCollectionShape(local.shapePrefix))
20611
+ return errors;
20612
+ errors.push({
20613
+ code: "VALIDATION_ERROR",
20614
+ operationIndex,
20615
+ message: `Name "${name}" contains reserved character "+". The "+" character is reserved for the historical collection auto-name namespace and is not allowed in user-supplied names.`
20616
+ });
20617
+ }
20618
+ return errors;
20619
+ }
20620
+ function validateCollectionAbouts(op, operationIndex) {
20621
+ const errors = [];
20622
+ if (!op.about || typeof op.about === "string")
20623
+ return errors;
20624
+ errors.push({
20625
+ code: "VALIDATION_ERROR",
20626
+ operationIndex,
20627
+ message: COLLECTION_ABOUT_REMOVED_MESSAGE
20628
+ });
20629
+ return errors;
20630
+ }
20631
+ function validateCollectionOps(op, operationIndex) {
20632
+ const errors = [];
20633
+ if (op.kind !== "collection")
20634
+ return errors;
20635
+ if (!collectionOps.includes(op.operation)) {
20636
+ return errors;
20637
+ }
20638
+ if (op.operation === "add" && !op.name) {
20639
+ errors.push({
20640
+ code: "VALIDATION_ERROR",
20641
+ operationIndex,
20642
+ message: COLLECTION_CREATE_REQUIRES_NAME_MESSAGE
20643
+ });
20644
+ }
20645
+ if (!op.type || !collectionTypes.includes(op.type)) {
20646
+ errors.push({
20647
+ code: "VALIDATION_ERROR",
20648
+ operationIndex,
20649
+ message: `Collection "type" is invalid. Use one of: ${canonicalCollectionTypes.join(", ")}. Got: "${op.type ?? ""}"`
20650
+ });
20651
+ }
20652
+ if (!op.members || !Array.isArray(op.members)) {
20653
+ errors.push({
20654
+ code: "VALIDATION_ERROR",
20655
+ operationIndex,
20656
+ message: 'Collection requires a "members" array'
20657
+ });
20658
+ } else {
20659
+ for (let i = 0;i < op.members.length; i++) {
20660
+ if (typeof op.members[i] !== "string") {
20661
+ errors.push({
20662
+ code: "VALIDATION_ERROR",
20663
+ operationIndex,
20664
+ message: `Collection member at index ${i} must be a string`
20665
+ });
20666
+ }
20667
+ }
20668
+ }
20669
+ if (op.type && op.members) {
20670
+ const arityError = collectionArityError(op.type, op.members);
20671
+ if (arityError) {
20672
+ errors.push({
20673
+ code: "VALIDATION_ERROR",
20674
+ operationIndex,
20675
+ message: arityError
20676
+ });
20677
+ }
20678
+ }
20679
+ return errors;
20680
+ }
20681
+ function collectionArityError(tag, members) {
20682
+ switch (tag) {
20683
+ case "arc":
20684
+ return members.length !== 2 ? `Arc requires exactly 2 members, got ${members.length}` : null;
20685
+ case "bond":
20686
+ return members.length !== 2 ? `Bond requires exactly 2 members, got ${members.length}` : null;
20687
+ case "pair":
20688
+ return members.length !== 2 ? `Pair requires exactly 2 members, got ${members.length}` : null;
20689
+ case "set":
20690
+ case "list":
20691
+ return members.length < 1 ? `${tag === "set" ? "Set" : "List"} requires at least 1 member, got 0` : null;
20692
+ }
20693
+ }
20694
+ // ../../packages/rules/src/preflight.ts
20695
+ function preflightOpDiagnostics2(op, operationIndex) {
20696
+ return preflightOpDiagnostics(op, operationIndex);
20697
+ }
20698
+ function preflightCommitDiagnostics2(operations, options) {
20699
+ return preflightCommitDiagnostics(operations, options);
20700
+ }
20414
20701
  // ../../packages/rules/src/shape-types.ts
20415
20702
  var BASE_PRIMITIVE_TYPES = [
20416
20703
  "number",
@@ -20608,6 +20895,14 @@ function displayFieldEntry(fieldType) {
20608
20895
  return { type, description };
20609
20896
  return type;
20610
20897
  }
20898
+ // ../../packages/rules/src/shape-field-key.ts
20899
+ function foldFieldName(name) {
20900
+ const stripped = name.endsWith("?") ? name.slice(0, -1) : name;
20901
+ return stripped.toLowerCase();
20902
+ }
20903
+ function foldFieldPath(path) {
20904
+ return path.split(".").map((segment) => foldFieldName(segment)).join(".");
20905
+ }
20611
20906
 
20612
20907
  // ../../node_modules/.bun/re2js@2.8.3/node_modules/re2js/build/index.js
20613
20908
  /*!
@@ -27102,372 +27397,7 @@ function normalizeOptionalTypeSpec(spec) {
27102
27397
  }
27103
27398
  return { spec, optionalByType: false };
27104
27399
  }
27105
- // ../../packages/rules/src/external-contract.ts
27106
- var FORBIDDEN_EXTERNAL_FIELDS = new Set([
27107
- "_id",
27108
- "_creationTime",
27109
- "repoId",
27110
- "orgId",
27111
- "thingId",
27112
- "shapeThingId",
27113
- "aboutThingId",
27114
- "currentVersionId",
27115
- "createdInCommitId",
27116
- "validatedShapeVersionId"
27117
- ]);
27118
- // ../../packages/rules/src/name-charset.ts
27119
- var RESERVED_NAME_SEGMENT_CHARS = ["?", "#", "@", ":", "$"];
27120
- function escapeForCharClass(char) {
27121
- return char.replace(/[\\\]^-]/g, "\\$&");
27122
- }
27123
- var RESERVED_CLASS_BODY = RESERVED_NAME_SEGMENT_CHARS.map(escapeForCharClass).join("");
27124
- var NAME_SEGMENT_FORBIDDEN_RE = new RegExp(`[${RESERVED_CLASS_BODY}\\s]`);
27125
- var PATH_SEGMENT_FORBIDDEN_RE = new RegExp(`[/${RESERVED_CLASS_BODY}\\s]`);
27126
- // ../../packages/rules/src/permission-scopes.ts
27127
- var PUBLIC_ORG_PERMISSIONS = new Set([
27128
- "org:read",
27129
- "components:read"
27130
- ]);
27131
- // ../../packages/rules/src/tokens.ts
27132
- var COMMIT_TOKEN_SYNTAX_REMOVED_MESSAGE = "$N/#N commit-token syntax is no longer supported. Use explicit names and explicit wrefs. For assertions about newly created things, create the thing with a deterministic name and set about to that wref in the same commit.";
27133
- var ANY_TOKEN_RE = /[$#]\d+/;
27134
- function hasAnyTokens(s) {
27135
- return ANY_TOKEN_RE.test(s);
27136
- }
27137
-
27138
- // ../../packages/rules/src/preflight-commit.ts
27139
- function preflightCommitDiagnostics(operations, options) {
27140
- const errors = [];
27141
- rejectCommitTokenSyntax(operations, errors, options);
27142
- illegalOpSequences(operations, errors, options?.checkAddAdd ?? true, options);
27143
- return errors;
27144
- }
27145
- function sourceOperationIndex(filteredIndex, options) {
27146
- return options?.sourceOperationIndexes?.[filteredIndex] ?? filteredIndex;
27147
- }
27148
- function getOpName(op) {
27149
- return op.name;
27150
- }
27151
- function tokenStringFields(op) {
27152
- const fields = [getOpName(op), op.newName];
27153
- if (typeof op.about === "string") {
27154
- fields.push(op.about);
27155
- }
27156
- if (op.members) {
27157
- fields.push(...op.members);
27158
- }
27159
- return fields;
27160
- }
27161
- function rejectCommitTokenSyntax(operations, errors, options) {
27162
- for (let i = 0;i < operations.length; i++) {
27163
- const op = operations[i];
27164
- if (!op)
27165
- continue;
27166
- for (const field of tokenStringFields(op)) {
27167
- if (field && hasAnyTokens(field)) {
27168
- errors.push({
27169
- code: "COMMIT_TOKEN_SYNTAX_REMOVED",
27170
- operationIndex: sourceOperationIndex(i, options),
27171
- message: COMMIT_TOKEN_SYNTAX_REMOVED_MESSAGE
27172
- });
27173
- break;
27174
- }
27175
- }
27176
- }
27177
- }
27178
- function illegalOpSequences(operations, errors, checkAddAdd, options) {
27179
- const opHistory = new Map;
27180
- for (let i = 0;i < operations.length; i++) {
27181
- const op = operations[i];
27182
- if (!op)
27183
- continue;
27184
- const name = getOpName(op);
27185
- if (!name)
27186
- continue;
27187
- if (hasAnyTokens(name))
27188
- continue;
27189
- const kind = inferOperationKind({ ...op, name });
27190
- const qualName = kind === "shape" ? `shape:${name}` : `thing:${name}`;
27191
- const history = opHistory.get(qualName) ?? [];
27192
- history.push({
27193
- operation: op.operation,
27194
- index: sourceOperationIndex(i, options)
27195
- });
27196
- opHistory.set(qualName, history);
27197
- }
27198
- for (const [qualName, history] of opHistory) {
27199
- if (history.length < 2)
27200
- continue;
27201
- for (let i = 1;i < history.length; i++) {
27202
- const prev = history[i - 1];
27203
- const curr = history[i];
27204
- if (!prev || !curr)
27205
- continue;
27206
- const pair = `${prev.operation}+${curr.operation}`;
27207
- if (checkAddAdd && pair === "add+add") {
27208
- errors.push({
27209
- code: "ILLEGAL_OP_SEQUENCE",
27210
- operationIndex: curr.index,
27211
- message: `Cannot add "${qualName}" twice in the same commit`
27212
- });
27213
- }
27214
- if (pair === "revise+add") {
27215
- errors.push({
27216
- code: "ILLEGAL_OP_SEQUENCE",
27217
- operationIndex: curr.index,
27218
- message: `Cannot revise then add "${qualName}" in the same commit`
27219
- });
27220
- }
27221
- }
27222
- }
27223
- }
27224
27400
 
27225
- // ../../packages/rules/src/preflight-operation.ts
27226
- var collectionTypes = ["arc", "bond", "set", "list", "pair"];
27227
- var canonicalCollectionTypes = ["arc", "bond", "set", "list"];
27228
- var collectionOps = ["add", "revise"];
27229
- var COLLECTION_CREATE_REQUIRES_NAME_MESSAGE = "Collection create requires a name. Collections are ordinary named things (ADR 0004).";
27230
- var COLLECTION_ABOUT_REMOVED_MESSAGE = 'about accepts a wref. Create the collection as its own named operation, then point the assertion at it. Prefer deterministic relationship names, for example: [{"operation":"add","kind":"collection","type":"arc","name":"a-to-b","members":["A","B"]},{"operation":"add","kind":"assertion","about":"Arc/a-to-b","name":"Assertion/example","data":{}}]. For CLI usage, use wh commit submit --file with the two operations.';
27231
- function preflightOpDiagnostics(op, operationIndex) {
27232
- const errors = [];
27233
- errors.push(...builtinShapeGuard(op, operationIndex));
27234
- errors.push(...contentNameGuard(op, operationIndex));
27235
- errors.push(...plusSignGuard(op, operationIndex));
27236
- errors.push(...validateCollectionAbouts(op, operationIndex));
27237
- errors.push(...validateCollectionOps(op, operationIndex));
27238
- return errors;
27239
- }
27240
- function builtinShapeGuard(op, operationIndex) {
27241
- const errors = [];
27242
- const name = op.name;
27243
- const isShapeRename = op.operation === "rename" && (op.kind === "shape" || op.name !== undefined && !splitLocalPath(op.name));
27244
- const reservedSourcePassThrough = isShapeRename && name !== undefined && isRenameableSquattedShape(name) && op.newName !== undefined && !isReservedCollectionShape(op.newName) && !isBuiltinShape(op.newName);
27245
- if (name && isRetiredCollectionShape(name) && !reservedSourcePassThrough) {
27246
- errors.push({
27247
- code: "RESERVED_NAME",
27248
- operationIndex,
27249
- message: `Shape "${name}" is a retired collection shape and cannot be written manually`
27250
- });
27251
- }
27252
- if (op.operation === "rename" && (op.kind === "shape" || op.name !== undefined && !splitLocalPath(op.name)) && op.newName && isRetiredCollectionShape(op.newName)) {
27253
- errors.push({
27254
- code: "RESERVED_NAME",
27255
- operationIndex,
27256
- message: `Shape "${op.newName}" is a retired collection shape and cannot be written manually`
27257
- });
27258
- } else {
27259
- const builtinShapeName = name && isBuiltinShape(name) && !reservedSourcePassThrough ? name : isShapeRename && op.newName && isBuiltinShape(op.newName) ? op.newName : undefined;
27260
- if (builtinShapeName && (isShapeRename || op.operation !== "retract" && op.kind === "shape")) {
27261
- const action = op.operation === "add" ? "created" : op.operation === "rename" ? "renamed" : "revised";
27262
- errors.push({
27263
- code: "RESERVED_NAME",
27264
- operationIndex,
27265
- message: `Shape "${builtinShapeName}" is a built-in shape and cannot be ${action} manually`
27266
- });
27267
- }
27268
- }
27269
- if (name) {
27270
- const local = splitLocalPath(name);
27271
- if (local && isRetiredCollectionShape(local.shapePrefix)) {
27272
- errors.push({
27273
- code: "VALIDATION_ERROR",
27274
- operationIndex,
27275
- message: `Cannot ${op.operation} under retired collection shape "${local.shapePrefix}". Triple is read-only and retired for new collection writes.`
27276
- });
27277
- } else if (op.kind === "thing" && local && isBuiltinCollectionShape(local.shapePrefix)) {
27278
- const message = op.operation === "add" ? `Cannot add kind="thing" under built-in shape "${local.shapePrefix}". Use kind="collection" instead.` : `Cannot revise kind="thing" under built-in shape "${local.shapePrefix}". Use kind="collection" to revise a collection.`;
27279
- errors.push({
27280
- code: "VALIDATION_ERROR",
27281
- operationIndex,
27282
- message
27283
- });
27284
- }
27285
- }
27286
- return errors;
27287
- }
27288
- function contentNameGuard(op, operationIndex) {
27289
- if (op.kind !== "thing" || !op.name)
27290
- return [];
27291
- const local = splitLocalPath(op.name);
27292
- if (!local || !isContentShape(local.shapePrefix))
27293
- return [];
27294
- const bareName = local.bareName;
27295
- if (isSynthesizedContentName(bareName)) {
27296
- return [
27297
- {
27298
- code: "READ_ONLY_BUILTIN_CONTENT",
27299
- operationIndex,
27300
- message: `${local.shapePrefix}/${bareName} is synthesized; writes are not allowed`
27301
- }
27302
- ];
27303
- }
27304
- if (!isStoredContentName(bareName)) {
27305
- return [
27306
- {
27307
- code: "UNKNOWN_CONTENT_NAME",
27308
- operationIndex,
27309
- message: `${local.shapePrefix}/${bareName} is not a recognized well-known content name`
27310
- }
27311
- ];
27312
- }
27313
- return [];
27314
- }
27315
- function plusSignGuard(op, operationIndex) {
27316
- const errors = [];
27317
- const name = op.name;
27318
- if (op.newName?.includes("+")) {
27319
- errors.push({
27320
- code: "VALIDATION_ERROR",
27321
- operationIndex,
27322
- message: `Name "${op.newName}" contains reserved character "+". The "+" character is reserved for the historical collection auto-name namespace and is not allowed in user-supplied names.`
27323
- });
27324
- return errors;
27325
- }
27326
- if (name?.includes("+")) {
27327
- if (op.kind === "collection" && op.operation === "add") {
27328
- errors.push({
27329
- code: "VALIDATION_ERROR",
27330
- operationIndex,
27331
- message: `Name "${name}" contains reserved character "+". The "+" character is reserved for the historical collection auto-name namespace and is not allowed in user-supplied names.`
27332
- });
27333
- return errors;
27334
- }
27335
- if (op.kind === "collection")
27336
- return errors;
27337
- const local = splitLocalPath(name);
27338
- if (local && isReservedCollectionShape(local.shapePrefix))
27339
- return errors;
27340
- errors.push({
27341
- code: "VALIDATION_ERROR",
27342
- operationIndex,
27343
- message: `Name "${name}" contains reserved character "+". The "+" character is reserved for the historical collection auto-name namespace and is not allowed in user-supplied names.`
27344
- });
27345
- }
27346
- return errors;
27347
- }
27348
- function validateCollectionAbouts(op, operationIndex) {
27349
- const errors = [];
27350
- if (!op.about || typeof op.about === "string")
27351
- return errors;
27352
- errors.push({
27353
- code: "VALIDATION_ERROR",
27354
- operationIndex,
27355
- message: COLLECTION_ABOUT_REMOVED_MESSAGE
27356
- });
27357
- return errors;
27358
- }
27359
- function validateCollectionOps(op, operationIndex) {
27360
- const errors = [];
27361
- if (op.kind !== "collection")
27362
- return errors;
27363
- if (!collectionOps.includes(op.operation)) {
27364
- return errors;
27365
- }
27366
- if (op.operation === "add" && !op.name) {
27367
- errors.push({
27368
- code: "VALIDATION_ERROR",
27369
- operationIndex,
27370
- message: COLLECTION_CREATE_REQUIRES_NAME_MESSAGE
27371
- });
27372
- }
27373
- if (!op.type || !collectionTypes.includes(op.type)) {
27374
- errors.push({
27375
- code: "VALIDATION_ERROR",
27376
- operationIndex,
27377
- message: `Collection "type" is invalid. Use one of: ${canonicalCollectionTypes.join(", ")}. Got: "${op.type ?? ""}"`
27378
- });
27379
- }
27380
- if (!op.members || !Array.isArray(op.members)) {
27381
- errors.push({
27382
- code: "VALIDATION_ERROR",
27383
- operationIndex,
27384
- message: 'Collection requires a "members" array'
27385
- });
27386
- } else {
27387
- for (let i = 0;i < op.members.length; i++) {
27388
- if (typeof op.members[i] !== "string") {
27389
- errors.push({
27390
- code: "VALIDATION_ERROR",
27391
- operationIndex,
27392
- message: `Collection member at index ${i} must be a string`
27393
- });
27394
- }
27395
- }
27396
- }
27397
- if (op.type && op.members) {
27398
- const arityError = collectionArityError(op.type, op.members);
27399
- if (arityError) {
27400
- errors.push({
27401
- code: "VALIDATION_ERROR",
27402
- operationIndex,
27403
- message: arityError
27404
- });
27405
- }
27406
- }
27407
- return errors;
27408
- }
27409
- function collectionArityError(tag, members) {
27410
- switch (tag) {
27411
- case "arc":
27412
- return members.length !== 2 ? `Arc requires exactly 2 members, got ${members.length}` : null;
27413
- case "bond":
27414
- return members.length !== 2 ? `Bond requires exactly 2 members, got ${members.length}` : null;
27415
- case "pair":
27416
- return members.length !== 2 ? `Pair requires exactly 2 members, got ${members.length}` : null;
27417
- case "set":
27418
- case "list":
27419
- return members.length < 1 ? `${tag === "set" ? "Set" : "List"} requires at least 1 member, got 0` : null;
27420
- }
27421
- }
27422
- // ../../packages/rules/src/preflight.ts
27423
- function preflightOpDiagnostics2(op, operationIndex) {
27424
- return preflightOpDiagnostics(op, operationIndex);
27425
- }
27426
- function preflightCommitDiagnostics2(operations, options) {
27427
- return preflightCommitDiagnostics(operations, options);
27428
- }
27429
- // ../../packages/rules/src/read-limits.ts
27430
- var MAX_GET_MANY_WREFS = 500;
27431
- // ../../packages/rules/src/reserved-orgs.ts
27432
- var RESERVED_RAW_CONTENT_TOP_LEVEL_NAMES = [
27433
- "_app",
27434
- "_static",
27435
- "api",
27436
- "health",
27437
- "healthz",
27438
- "mcp",
27439
- "readyz",
27440
- "robots.txt",
27441
- "sse",
27442
- "trpc",
27443
- "version"
27444
- ];
27445
- var RESERVED_ORG_NAMES = [
27446
- ...RESERVED_RAW_CONTENT_TOP_LEVEL_NAMES,
27447
- "admin",
27448
- "billing",
27449
- "blog",
27450
- "docs",
27451
- "help",
27452
- "login",
27453
- "public",
27454
- "settings",
27455
- "signup",
27456
- "status",
27457
- "support",
27458
- "system",
27459
- "warmhub",
27460
- "www"
27461
- ];
27462
- var RESERVED_ORG_NAME_SET = new Set(RESERVED_ORG_NAMES);
27463
- // ../../packages/rules/src/shape-field-key.ts
27464
- function foldFieldName(name) {
27465
- const stripped = name.endsWith("?") ? name.slice(0, -1) : name;
27466
- return stripped.toLowerCase();
27467
- }
27468
- function foldFieldPath(path) {
27469
- return path.split(".").map((segment) => foldFieldName(segment)).join(".");
27470
- }
27471
27401
  // ../../packages/rules/src/shape-validation-runtime.ts
27472
27402
  function validatePersistedStringFieldLimits(value, typeDef, errors, path) {
27473
27403
  const normalized = normalizeOptionalTypeSpec(typeDef).spec;
@@ -28550,7 +28480,7 @@ function dedupeDeprecationsByShape(results) {
28550
28480
  // ../../packages/sdk-ts/package.json
28551
28481
  var package_default = {
28552
28482
  name: "@warmhub/sdk-ts",
28553
- version: "0.82.3",
28483
+ version: "0.83.0",
28554
28484
  private: false,
28555
28485
  type: "module",
28556
28486
  description: "The TypeScript SDK for WarmHub — create repos, commit and query data, and compound knowledge with your AI agents.",
@@ -28705,40 +28635,64 @@ function assertPaginatedCursorAdvanced(cursor, nextCursor, seenCursors) {
28705
28635
  throw new WarmHubError("VALIDATION_ERROR", "Paginated result cursor did not advance");
28706
28636
  }
28707
28637
  }
28708
- async function* paginate(fetchPage, extractItems, initialCursor) {
28638
+ function assertIncrementalLowerBound(sinceRepoSeq) {
28639
+ if (sinceRepoSeq === undefined) {
28640
+ throw new WarmHubError("VALIDATION_ERROR", "sinceRepoSeq is required for an incremental read");
28641
+ }
28642
+ }
28643
+ async function* paginatePages(fetchPage, initialCursor) {
28709
28644
  let cursor = initialCursor;
28710
28645
  const seenCursors = new Set;
28711
28646
  for (;; ) {
28712
28647
  if (cursor)
28713
28648
  seenCursors.add(cursor);
28714
28649
  const page = await fetchPage(cursor);
28715
- for (const item of extractItems(page)) {
28716
- yield item;
28717
- }
28650
+ yield page;
28718
28651
  if (!page.nextCursor)
28719
28652
  return;
28720
28653
  assertPaginatedCursorAdvanced(cursor, page.nextCursor, seenCursors);
28721
28654
  cursor = page.nextCursor;
28722
28655
  }
28723
28656
  }
28657
+ async function* paginate(fetchPage, extractItems, initialCursor) {
28658
+ for await (const page of paginatePages(fetchPage, initialCursor)) {
28659
+ yield* extractItems(page);
28660
+ }
28661
+ }
28724
28662
  async function collectPaginatedPages(fetchPage, extractItems, max, initialCursor) {
28725
28663
  if (max !== undefined && (!Number.isFinite(max) || Math.trunc(max) !== max || max < 0)) {
28726
28664
  throw new WarmHubError("VALIDATION_ERROR", "max must be a nonnegative integer");
28727
28665
  }
28728
28666
  const items = [];
28729
- let cursor = initialCursor;
28667
+ for await (const page of paginatePages(fetchPage, initialCursor)) {
28668
+ const pageItems = extractItems(page);
28669
+ if (max !== undefined && items.length + pageItems.length > max) {
28670
+ throw new WarmHubError("VALIDATION_ERROR", `Paginated result exceeded max=${max}`);
28671
+ }
28672
+ items.push(...pageItems);
28673
+ }
28674
+ return items;
28675
+ }
28676
+ function assertRepoExploreBrowseMode(opts) {
28677
+ if (opts?.slugs !== undefined) {
28678
+ throw new WarmHubError("VALIDATION_ERROR", "repo.explore pagination helpers do not support slugs mode");
28679
+ }
28680
+ }
28681
+ async function collectIncrementalPages(fetchPage) {
28682
+ const items = [];
28683
+ let cursor;
28730
28684
  const seenCursors = new Set;
28731
28685
  for (;; ) {
28732
28686
  if (cursor)
28733
28687
  seenCursors.add(cursor);
28734
28688
  const page = await fetchPage(cursor);
28735
- const pageItems = extractItems(page);
28736
- if (max !== undefined && items.length + pageItems.length > max) {
28737
- throw new WarmHubError("VALIDATION_ERROR", `Paginated result exceeded max=${max}`);
28689
+ items.push(...page.items);
28690
+ if (!page.nextCursor) {
28691
+ if (page.repoSeq === undefined) {
28692
+ throw new WarmHubError("VALIDATION_ERROR", "Incremental read completed without repoSeq");
28693
+ }
28694
+ return { items, repoSeq: page.repoSeq };
28738
28695
  }
28739
- items.push(...pageItems);
28740
- if (!page.nextCursor)
28741
- return items;
28742
28696
  assertPaginatedCursorAdvanced(cursor, page.nextCursor, seenCursors);
28743
28697
  cursor = page.nextCursor;
28744
28698
  }
@@ -29141,6 +29095,13 @@ class WarmHubClient {
29141
29095
  throw toWarmHubError(error);
29142
29096
  }
29143
29097
  },
29098
+ listIter: (orgName, repoName, opts) => {
29099
+ return paginate((cursor) => this.component.list(orgName, repoName, { ...opts, cursor }), (page) => page.items, opts?.cursor);
29100
+ },
29101
+ listAll: async (orgName, repoName, opts) => {
29102
+ const { max, ...pageOpts } = opts ?? {};
29103
+ return await collectPaginatedPages((cursor) => this.component.list(orgName, repoName, { ...pageOpts, cursor }), (page) => page.items, max, pageOpts.cursor);
29104
+ },
29144
29105
  search: async (query, opts) => {
29145
29106
  try {
29146
29107
  return await this.trpc.component.search.query({
@@ -29152,6 +29113,13 @@ class WarmHubClient {
29152
29113
  throw toWarmHubError(error);
29153
29114
  }
29154
29115
  },
29116
+ searchIter: (query, opts) => {
29117
+ return paginate((cursor) => this.component.search(query, { ...opts, cursor }), (page) => page.items, opts?.cursor);
29118
+ },
29119
+ searchAll: async (query, opts) => {
29120
+ const { max, ...pageOpts } = opts ?? {};
29121
+ return await collectPaginatedPages((cursor) => this.component.search(query, { ...pageOpts, cursor }), (page) => page.items, max, pageOpts.cursor);
29122
+ },
29155
29123
  get: async (orgName, repoName, componentRef) => {
29156
29124
  try {
29157
29125
  return await this.trpc.component.get.query({
@@ -29531,6 +29499,13 @@ class WarmHubClient {
29531
29499
  throw toWarmHubError(error);
29532
29500
  }
29533
29501
  },
29502
+ listIter: (orgName, opts) => {
29503
+ return paginate((cursor) => this.repo.list(orgName, { ...opts, cursor }), (page) => page.items, opts?.cursor);
29504
+ },
29505
+ listAll: async (orgName, opts) => {
29506
+ const { max, ...pageOpts } = opts ?? {};
29507
+ return await collectPaginatedPages((cursor) => this.repo.list(orgName, { ...pageOpts, cursor }), (page) => page.items, max, pageOpts.cursor);
29508
+ },
29534
29509
  search: async (query, opts) => {
29535
29510
  try {
29536
29511
  return await this.trpc.repo.search.query({
@@ -29542,6 +29517,13 @@ class WarmHubClient {
29542
29517
  throw toWarmHubError(error);
29543
29518
  }
29544
29519
  },
29520
+ searchIter: (query, opts) => {
29521
+ return paginate((cursor) => this.repo.search(query, { ...opts, cursor }), (page) => page.items, opts?.cursor);
29522
+ },
29523
+ searchAll: async (query, opts) => {
29524
+ const { max, ...pageOpts } = opts ?? {};
29525
+ return await collectPaginatedPages((cursor) => this.repo.search(query, { ...pageOpts, cursor }), (page) => page.items, max, pageOpts.cursor);
29526
+ },
29545
29527
  create: async (orgName, repoName, description, visibility, displayName) => {
29546
29528
  try {
29547
29529
  return await this.trpc.repo.create.mutate({
@@ -29651,6 +29633,13 @@ class WarmHubClient {
29651
29633
  throw toWarmHubError(error);
29652
29634
  }
29653
29635
  },
29636
+ listPageIter: (orgName, opts) => {
29637
+ return paginate((cursor) => this.repo.listPage(orgName, { ...opts, cursor }), (page) => page.items, opts?.cursor);
29638
+ },
29639
+ listPageAll: async (orgName, opts) => {
29640
+ const { max, ...pageOpts } = opts ?? {};
29641
+ return await collectPaginatedPages((cursor) => this.repo.listPage(orgName, { ...pageOpts, cursor }), (page) => page.items, max, pageOpts.cursor);
29642
+ },
29654
29643
  listForCaller: async (opts) => {
29655
29644
  try {
29656
29645
  return await this.trpc.repo.listForCaller.query({
@@ -29678,6 +29667,15 @@ class WarmHubClient {
29678
29667
  throw toWarmHubError(error);
29679
29668
  }
29680
29669
  },
29670
+ exploreIter: (opts) => {
29671
+ assertRepoExploreBrowseMode(opts);
29672
+ return paginate((cursor) => this.repo.explore({ ...opts, cursor }), (page) => page.items, opts?.cursor);
29673
+ },
29674
+ exploreAll: async (opts) => {
29675
+ assertRepoExploreBrowseMode(opts);
29676
+ const { max, ...pageOpts } = opts ?? {};
29677
+ return await collectPaginatedPages((cursor) => this.repo.explore({ ...pageOpts, cursor }), (page) => page.items, max, pageOpts.cursor);
29678
+ },
29681
29679
  getReadme: async (orgName, repoName) => {
29682
29680
  try {
29683
29681
  return await this.trpc.repo.getReadme.query({
@@ -29866,6 +29864,13 @@ class WarmHubClient {
29866
29864
  } catch (error) {
29867
29865
  throw toWarmHubError(error);
29868
29866
  }
29867
+ },
29868
+ historyIter: (orgName, repoName, name, opts = {}) => {
29869
+ return paginate((cursor) => this.shape.history(orgName, repoName, name, { ...opts, cursor }), (page) => page.versions, opts.cursor);
29870
+ },
29871
+ historyAll: async (orgName, repoName, name, opts) => {
29872
+ const { max, ...pageOpts } = opts ?? {};
29873
+ return await collectPaginatedPages((cursor) => this.shape.history(orgName, repoName, name, { ...pageOpts, cursor }), (page) => page.versions, max, pageOpts.cursor);
29869
29874
  }
29870
29875
  };
29871
29876
  subscription = {
@@ -30024,6 +30029,19 @@ class WarmHubClient {
30024
30029
  throw toWarmHubError(error);
30025
30030
  }
30026
30031
  },
30032
+ liveFeedIter: (orgName, repoName, subscriptionName, opts) => {
30033
+ return paginate((cursor) => this.action.liveFeed(orgName, repoName, subscriptionName, {
30034
+ ...opts,
30035
+ cursor
30036
+ }), (page) => page.items, opts?.cursor);
30037
+ },
30038
+ liveFeedAll: async (orgName, repoName, subscriptionName, opts) => {
30039
+ const { max, ...pageOpts } = opts ?? {};
30040
+ return await collectPaginatedPages((cursor) => this.action.liveFeed(orgName, repoName, subscriptionName, {
30041
+ ...pageOpts,
30042
+ cursor
30043
+ }), (page) => page.items, max, pageOpts.cursor);
30044
+ },
30027
30045
  listRuns: async (orgName, repoName, opts) => {
30028
30046
  try {
30029
30047
  return await this.trpc.action.listRuns.query({
@@ -30040,6 +30058,21 @@ class WarmHubClient {
30040
30058
  throw toWarmHubError(error);
30041
30059
  }
30042
30060
  },
30061
+ listRunsIter: (orgName, repoName, opts) => {
30062
+ return paginate((cursor) => this.action.listRuns(orgName, repoName, {
30063
+ ...opts,
30064
+ since: cursor === undefined ? opts?.since : undefined,
30065
+ cursor
30066
+ }), (page) => page.items, opts?.cursor);
30067
+ },
30068
+ listRunsAll: async (orgName, repoName, opts) => {
30069
+ const { max, ...pageOpts } = opts ?? {};
30070
+ return await collectPaginatedPages((cursor) => this.action.listRuns(orgName, repoName, {
30071
+ ...pageOpts,
30072
+ since: cursor === undefined ? pageOpts.since : undefined,
30073
+ cursor
30074
+ }), (page) => page.items, max, pageOpts.cursor);
30075
+ },
30043
30076
  latestRuns: async (orgName, repoName) => {
30044
30077
  try {
30045
30078
  return await this.trpc.action.latestRuns.query({ orgName, repoName });
@@ -30238,7 +30271,8 @@ class WarmHubClient {
30238
30271
  componentRef: opts?.componentRef,
30239
30272
  excludeComponents: opts?.excludeComponents,
30240
30273
  excludeInfraShapes: opts?.excludeInfraShapes,
30241
- where: opts?.where
30274
+ where: opts?.where,
30275
+ sinceRepoSeq: opts?.sinceRepoSeq
30242
30276
  });
30243
30277
  } catch (error) {
30244
30278
  throw toWarmHubError(error);
@@ -30251,6 +30285,14 @@ class WarmHubClient {
30251
30285
  const { max, ...pageOpts } = opts ?? {};
30252
30286
  return await collectPaginatedPages((cursor) => this.thing.head(orgName, repoName, { ...pageOpts, cursor }), (page) => page.items, max, pageOpts.cursor);
30253
30287
  },
30288
+ headChanges: async (orgName, repoName, opts) => {
30289
+ assertIncrementalLowerBound(opts?.sinceRepoSeq);
30290
+ return await collectIncrementalPages((cursor) => this.thing.head(orgName, repoName, {
30291
+ ...opts,
30292
+ includeRetracted: true,
30293
+ cursor
30294
+ }));
30295
+ },
30254
30296
  get: async (orgName, repoName, wref, version, opts) => {
30255
30297
  try {
30256
30298
  return await this.trpc.thing.get.query({
@@ -30394,6 +30436,13 @@ class WarmHubClient {
30394
30436
  throw toWarmHubError(error);
30395
30437
  }
30396
30438
  },
30439
+ historyIter: (orgName, repoName, opts) => {
30440
+ return paginate((cursor) => this.thing.history(orgName, repoName, { ...opts, cursor }), (page) => page.versions, opts.cursor);
30441
+ },
30442
+ historyAll: async (orgName, repoName, opts) => {
30443
+ const { max, ...pageOpts } = opts;
30444
+ return await collectPaginatedPages((cursor) => this.thing.history(orgName, repoName, { ...pageOpts, cursor }), (page) => page.versions, max, pageOpts.cursor);
30445
+ },
30397
30446
  rename: async (orgName, repoName, shapeName, oldName, newName) => {
30398
30447
  try {
30399
30448
  return await this.trpc.thing.rename.mutate({
@@ -30463,7 +30512,8 @@ class WarmHubClient {
30463
30512
  componentRef: opts?.componentRef,
30464
30513
  excludeComponents: opts?.excludeComponents,
30465
30514
  excludeInfraShapes: opts?.excludeInfraShapes,
30466
- where: opts?.where
30515
+ where: opts?.where,
30516
+ sinceRepoSeq: opts?.sinceRepoSeq
30467
30517
  });
30468
30518
  } catch (error) {
30469
30519
  throw toWarmHubError(error);
@@ -30476,6 +30526,14 @@ class WarmHubClient {
30476
30526
  const { max, ...pageOpts } = opts ?? {};
30477
30527
  return await collectPaginatedPages((cursor) => this.thing.query(orgName, repoName, { ...pageOpts, cursor }), (page) => page.items, max, pageOpts.cursor);
30478
30528
  },
30529
+ queryChanges: async (orgName, repoName, opts) => {
30530
+ assertIncrementalLowerBound(opts?.sinceRepoSeq);
30531
+ return await collectIncrementalPages((cursor) => this.thing.query(orgName, repoName, {
30532
+ ...opts,
30533
+ includeRetracted: true,
30534
+ cursor
30535
+ }));
30536
+ },
30479
30537
  search: async (orgName, repoName, query, opts) => {
30480
30538
  try {
30481
30539
  const kind = opts?.kind === "shape" || opts?.kind === "thing" || opts?.kind === "assertion" || opts?.kind === "collection" ? opts.kind : undefined;
@@ -30501,6 +30559,16 @@ class WarmHubClient {
30501
30559
  throw toWarmHubError(error);
30502
30560
  }
30503
30561
  },
30562
+ searchIter: (orgName, repoName, query, opts) => {
30563
+ return paginate((cursor) => this.thing.search(orgName, repoName, query, { ...opts, cursor }), (page) => page.items, opts?.cursor);
30564
+ },
30565
+ searchAll: async (orgName, repoName, query, opts) => {
30566
+ const { max, ...pageOpts } = opts ?? {};
30567
+ return await collectPaginatedPages((cursor) => this.thing.search(orgName, repoName, query, {
30568
+ ...pageOpts,
30569
+ cursor
30570
+ }), (page) => page.items, max, pageOpts.cursor);
30571
+ },
30504
30572
  count: async (orgName, repoName, opts) => {
30505
30573
  try {
30506
30574
  const kind = opts?.kind === "shape" || opts?.kind === "thing" || opts?.kind === "assertion" || opts?.kind === "collection" ? opts.kind : undefined;
@@ -30516,7 +30584,8 @@ class WarmHubClient {
30516
30584
  componentRef: opts?.componentRef,
30517
30585
  excludeComponents: opts?.excludeComponents,
30518
30586
  excludeInfraShapes: opts?.excludeInfraShapes,
30519
- where: opts?.where
30587
+ where: opts?.where,
30588
+ sinceRepoSeq: opts?.sinceRepoSeq
30520
30589
  });
30521
30590
  } catch (error) {
30522
30591
  throw toWarmHubError(error);
@@ -31044,6 +31113,7 @@ var _orgActivityNeedsNoFilter = ["org.member_added", "org.repo_created", "org.re
31044
31113
  }));
31045
31114
 
31046
31115
  // ../../packages/warmhub-cli/src/errors-classification.ts
31116
+ var INCREMENTAL_READ_UNAVAILABLE_GUIDANCE = "Retry the same incremental request after incremental reads are enabled, or simplify the query to a supported form. Do not fall back to a full read.";
31047
31117
  function unauthenticatedHint(message) {
31048
31118
  if (message.includes("Authentication required")) {
31049
31119
  return "Not logged in. Run `wh auth login` to authenticate.";
@@ -31070,6 +31140,8 @@ function classifyConflict(message, code) {
31070
31140
  return "pending-delete";
31071
31141
  case "LEASE_UNAVAILABLE":
31072
31142
  return "lease-held";
31143
+ case "INCREMENTAL_READ_UNAVAILABLE":
31144
+ return "incremental-read-unavailable";
31073
31145
  default:
31074
31146
  break;
31075
31147
  }
@@ -31103,6 +31175,8 @@ function conflictHint(message, code) {
31103
31175
  return "Repo is being deleted. Wait for the delete to finish or cancel it before retrying.";
31104
31176
  case "lease-held":
31105
31177
  return "This thing is leased by another holder. Back off until the lease expires (see leaseExpiresAt / retryAfter), then retry.";
31178
+ case "incremental-read-unavailable":
31179
+ return INCREMENTAL_READ_UNAVAILABLE_GUIDANCE;
31106
31180
  case "other":
31107
31181
  return "Resolve the conflicting existing state and try again.";
31108
31182
  }
@@ -31130,7 +31204,8 @@ var CONFLICT_SHAPED_CODES = new Set([
31130
31204
  "HAS_INBOUND_REFS",
31131
31205
  "REPO_PENDING_DELETE",
31132
31206
  "ALREADY_RETRACTED",
31133
- "LEASE_UNAVAILABLE"
31207
+ "LEASE_UNAVAILABLE",
31208
+ "INCREMENTAL_READ_UNAVAILABLE"
31134
31209
  ]);
31135
31210
 
31136
31211
  // ../../packages/warmhub-cli/src/errors-types.ts
@@ -31274,6 +31349,11 @@ function generateSuggestions(code, message, context, errorCode) {
31274
31349
  action: "Another holder leased this thing. Back off until the lease expires (leaseExpiresAt / retryAfter), then retry"
31275
31350
  });
31276
31351
  break;
31352
+ case "incremental-read-unavailable":
31353
+ suggestions.push({
31354
+ action: INCREMENTAL_READ_UNAVAILABLE_GUIDANCE
31355
+ });
31356
+ break;
31277
31357
  case "other":
31278
31358
  suggestions.push({
31279
31359
  action: "Resolve the conflicting existing state and retry"
@@ -36842,6 +36922,9 @@ async function fetchAllSearchPages(ctx, org, repo, queryText, opts) {
36842
36922
  // ../../packages/warmhub-cli/src/domains/thing/view.ts
36843
36923
  import { readFileSync as readFileSync7 } from "node:fs";
36844
36924
 
36925
+ // ../../packages/rules/src/read-limits.ts
36926
+ var MAX_GET_MANY_WREFS2 = 500;
36927
+
36845
36928
  // ../../packages/warmhub-cli/src/io.ts
36846
36929
  function isBrokenPipe(error) {
36847
36930
  return error instanceof Error && "code" in error && error.code === "EPIPE";
@@ -37078,8 +37161,8 @@ var handleView = async (ctx, { flags, args, terminator }) => {
37078
37161
  if (wrefs.length === 0) {
37079
37162
  throw new CliError(2 /* UserInput */, "USER_INPUT", "Missing required <wref>. Pass a wref as a positional arg, via --file <path>, or pipe newline-delimited wrefs on stdin.", undefined, "Example: wh thing view Game/base --depth 2");
37080
37163
  }
37081
- if (wrefs.length > MAX_GET_MANY_WREFS) {
37082
- throw new CliError(2 /* UserInput */, "USER_INPUT", `Too many wrefs: ${wrefs.length} (max ${MAX_GET_MANY_WREFS} per call).`, undefined, `Split your input into chunks of ${MAX_GET_MANY_WREFS} or fewer.`);
37164
+ if (wrefs.length > MAX_GET_MANY_WREFS2) {
37165
+ throw new CliError(2 /* UserInput */, "USER_INPUT", `Too many wrefs: ${wrefs.length} (max ${MAX_GET_MANY_WREFS2} per call).`, undefined, `Split your input into chunks of ${MAX_GET_MANY_WREFS2} or fewer.`);
37083
37166
  }
37084
37167
  const isBatch = wrefs.length > 1 || flags.file !== undefined;
37085
37168
  if (isBatch && flags.depth !== undefined) {
@@ -49120,7 +49203,7 @@ function resolveLogLevel(flagLevel, env) {
49120
49203
  // package.json
49121
49204
  var package_default3 = {
49122
49205
  name: "@warmhub/cli",
49123
- version: "0.84.3",
49206
+ version: "0.85.0",
49124
49207
  private: false,
49125
49208
  type: "module",
49126
49209
  description: "The wh CLI for WarmHub — create repos, commit and query data, and compound knowledge with your AI agents.",
@@ -49737,5 +49820,5 @@ process.exitCode = interceptedExitCode === undefined ? await runPreparedCli(laun
49737
49820
  version: package_default3.version
49738
49821
  }) : interceptedExitCode;
49739
49822
 
49740
- //# debugId=5B259BBB96D29C3364756E2164756E21
49741
- //# warmhub-cli-build-info {"cliVersion":"0.84.3","sdkVersion":"0.82.3"}
49823
+ //# debugId=F50B28EECDCA074C64756E2164756E21
49824
+ //# warmhub-cli-build-info {"cliVersion":"0.85.0","sdkVersion":"0.83.0"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@warmhub/cli",
3
- "version": "0.84.3",
3
+ "version": "0.85.0",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "The wh CLI for WarmHub — create repos, commit and query data, and compound knowledge with your AI agents.",