@lazehq/cli 0.1.97 → 0.1.99

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/laze.mjs +394 -121
  2. package/package.json +1 -1
package/dist/laze.mjs CHANGED
@@ -3244,7 +3244,7 @@ var require_websocket = __commonJS({
3244
3244
  var http = __require("http");
3245
3245
  var net = __require("net");
3246
3246
  var tls = __require("tls");
3247
- var { randomBytes: randomBytes6, createHash: createHash9 } = __require("crypto");
3247
+ var { randomBytes: randomBytes7, createHash: createHash9 } = __require("crypto");
3248
3248
  var { Duplex, Readable: Readable2 } = __require("stream");
3249
3249
  var { URL: URL3 } = __require("url");
3250
3250
  var PerMessageDeflate2 = require_permessage_deflate();
@@ -3782,7 +3782,7 @@ var require_websocket = __commonJS({
3782
3782
  }
3783
3783
  }
3784
3784
  const defaultPort = isSecure ? 443 : 80;
3785
- const key = randomBytes6(16).toString("base64");
3785
+ const key = randomBytes7(16).toString("base64");
3786
3786
  const request2 = isSecure ? https.request : http.request;
3787
3787
  const protocolSet = /* @__PURE__ */ new Set();
3788
3788
  let perMessageDeflate;
@@ -21645,12 +21645,12 @@ var require_date = __commonJS({
21645
21645
  return parseRfc850Date(date5);
21646
21646
  }
21647
21647
  }
21648
- function makeDate(year, monthIdx, day, hour, minute, second, weekday) {
21649
- const result2 = new Date(Date.UTC(year, monthIdx, day, hour, minute, second));
21648
+ function makeDate(year, monthIdx, day2, hour, minute, second, weekday) {
21649
+ const result2 = new Date(Date.UTC(year, monthIdx, day2, hour, minute, second));
21650
21650
  if (year >= 0 && year <= 99) {
21651
21651
  result2.setUTCFullYear(year);
21652
21652
  }
21653
- return result2.getUTCFullYear() === year && result2.getUTCMonth() === monthIdx && result2.getUTCDate() === day && result2.getUTCHours() === hour && result2.getUTCMinutes() === minute && result2.getUTCSeconds() === second && result2.getUTCDay() === weekday ? result2 : void 0;
21653
+ return result2.getUTCFullYear() === year && result2.getUTCMonth() === monthIdx && result2.getUTCDate() === day2 && result2.getUTCHours() === hour && result2.getUTCMinutes() === minute && result2.getUTCSeconds() === second && result2.getUTCDay() === weekday ? result2 : void 0;
21654
21654
  }
21655
21655
  function parseImfDate(date5) {
21656
21656
  if (date5.length !== 29 || date5[4] !== " " || date5[7] !== " " || date5[11] !== " " || date5[16] !== " " || date5[19] !== ":" || date5[22] !== ":" || date5[25] !== " " || date5[26] !== "G" || date5[27] !== "M" || date5[28] !== "T") {
@@ -21674,13 +21674,13 @@ var require_date = __commonJS({
21674
21674
  } else {
21675
21675
  return void 0;
21676
21676
  }
21677
- let day = 0;
21677
+ let day2 = 0;
21678
21678
  if (date5[5] === "0") {
21679
21679
  const code = date5.charCodeAt(6);
21680
21680
  if (code < 49 || code > 57) {
21681
21681
  return void 0;
21682
21682
  }
21683
- day = code - 48;
21683
+ day2 = code - 48;
21684
21684
  } else {
21685
21685
  const code1 = date5.charCodeAt(5);
21686
21686
  if (code1 < 49 || code1 > 51) {
@@ -21690,7 +21690,7 @@ var require_date = __commonJS({
21690
21690
  if (code2 < 48 || code2 > 57) {
21691
21691
  return void 0;
21692
21692
  }
21693
- day = (code1 - 48) * 10 + (code2 - 48);
21693
+ day2 = (code1 - 48) * 10 + (code2 - 48);
21694
21694
  }
21695
21695
  let monthIdx = -1;
21696
21696
  if (date5[8] === "J" && date5[9] === "a" && date5[10] === "n") {
@@ -21812,7 +21812,7 @@ var require_date = __commonJS({
21812
21812
  }
21813
21813
  second = (code1 - 48) * 10 + (code2 - 48);
21814
21814
  }
21815
- return makeDate(year, monthIdx, day, hour, minute, second, weekday);
21815
+ return makeDate(year, monthIdx, day2, hour, minute, second, weekday);
21816
21816
  }
21817
21817
  function parseAscTimeDate(date5) {
21818
21818
  if (date5.length !== 24 || date5[7] !== " " || date5[10] !== " " || date5[19] !== " ") {
@@ -21882,13 +21882,13 @@ var require_date = __commonJS({
21882
21882
  } else {
21883
21883
  return void 0;
21884
21884
  }
21885
- let day = 0;
21885
+ let day2 = 0;
21886
21886
  if (date5[8] === " ") {
21887
21887
  const code = date5.charCodeAt(9);
21888
21888
  if (code < 49 || code > 57) {
21889
21889
  return void 0;
21890
21890
  }
21891
- day = code - 48;
21891
+ day2 = code - 48;
21892
21892
  } else {
21893
21893
  const code1 = date5.charCodeAt(8);
21894
21894
  if (code1 < 49 || code1 > 51) {
@@ -21898,7 +21898,7 @@ var require_date = __commonJS({
21898
21898
  if (code2 < 48 || code2 > 57) {
21899
21899
  return void 0;
21900
21900
  }
21901
- day = (code1 - 48) * 10 + (code2 - 48);
21901
+ day2 = (code1 - 48) * 10 + (code2 - 48);
21902
21902
  }
21903
21903
  let hour = 0;
21904
21904
  if (date5[11] === "0") {
@@ -21974,7 +21974,7 @@ var require_date = __commonJS({
21974
21974
  return void 0;
21975
21975
  }
21976
21976
  const year = (yearDigit1 - 48) * 1e3 + (yearDigit2 - 48) * 100 + (yearDigit3 - 48) * 10 + (yearDigit4 - 48);
21977
- return makeDate(year, monthIdx, day, hour, minute, second, weekday);
21977
+ return makeDate(year, monthIdx, day2, hour, minute, second, weekday);
21978
21978
  }
21979
21979
  function parseRfc850Date(date5) {
21980
21980
  let commaIndex = -1;
@@ -22010,13 +22010,13 @@ var require_date = __commonJS({
22010
22010
  if (date5[commaIndex] !== "," || date5.length - commaIndex - 1 !== 23 || date5[commaIndex + 1] !== " " || date5[commaIndex + 4] !== "-" || date5[commaIndex + 8] !== "-" || date5[commaIndex + 11] !== " " || date5[commaIndex + 14] !== ":" || date5[commaIndex + 17] !== ":" || date5[commaIndex + 20] !== " " || date5[commaIndex + 21] !== "G" || date5[commaIndex + 22] !== "M" || date5[commaIndex + 23] !== "T") {
22011
22011
  return void 0;
22012
22012
  }
22013
- let day = 0;
22013
+ let day2 = 0;
22014
22014
  if (date5[commaIndex + 2] === "0") {
22015
22015
  const code = date5.charCodeAt(commaIndex + 3);
22016
22016
  if (code < 49 || code > 57) {
22017
22017
  return void 0;
22018
22018
  }
22019
- day = code - 48;
22019
+ day2 = code - 48;
22020
22020
  } else {
22021
22021
  const code1 = date5.charCodeAt(commaIndex + 2);
22022
22022
  if (code1 < 49 || code1 > 51) {
@@ -22026,7 +22026,7 @@ var require_date = __commonJS({
22026
22026
  if (code2 < 48 || code2 > 57) {
22027
22027
  return void 0;
22028
22028
  }
22029
- day = (code1 - 48) * 10 + (code2 - 48);
22029
+ day2 = (code1 - 48) * 10 + (code2 - 48);
22030
22030
  }
22031
22031
  let monthIdx = -1;
22032
22032
  if (date5[commaIndex + 5] === "J" && date5[commaIndex + 6] === "a" && date5[commaIndex + 7] === "n") {
@@ -22123,7 +22123,7 @@ var require_date = __commonJS({
22123
22123
  }
22124
22124
  second = (code1 - 48) * 10 + (code2 - 48);
22125
22125
  }
22126
- return makeDate(year, monthIdx, day, hour, minute, second, weekday);
22126
+ return makeDate(year, monthIdx, day2, hour, minute, second, weekday);
22127
22127
  }
22128
22128
  module.exports = {
22129
22129
  parseHttpDate
@@ -33140,11 +33140,11 @@ function computeIsoYearMonthFieldsForMonthDay(monthCodeNumber, isLeapMonth) {
33140
33140
  };
33141
33141
  }
33142
33142
  }
33143
- function computeIsoFieldsFromParts(year, month, day) {
33143
+ function computeIsoFieldsFromParts(year, month, day2) {
33144
33144
  return {
33145
33145
  year,
33146
33146
  month,
33147
- day
33147
+ day: day2
33148
33148
  };
33149
33149
  }
33150
33150
  function computeIsoDaysInMonth(year, month) {
@@ -33234,8 +33234,8 @@ function computeCalendarMonthCodeParts(calendar, year, month) {
33234
33234
  function computeCalendarEraFields(calendar, isoDate) {
33235
33235
  return 0 === calendar ? computeGregoryEraFields(isoDate) : calendar && calendar.h?.(isoDate) || {};
33236
33236
  }
33237
- function computeCalendarIsoFieldsFromParts(calendar, year, month, day) {
33238
- return calendar ? calendar.de(year, month, day) : computeIsoFieldsFromParts(year, month, day);
33237
+ function computeCalendarIsoFieldsFromParts(calendar, year, month, day2) {
33238
+ return calendar ? calendar.de(year, month, day2) : computeIsoFieldsFromParts(year, month, day2);
33239
33239
  }
33240
33240
  function computeCalendarMonthsInYearForYear(calendar, year) {
33241
33241
  return calendar ? calendar.j(year) : 12;
@@ -33667,8 +33667,8 @@ function roundBigNanoToInc(bigNano, bigNanoInc, roundingMode) {
33667
33667
  return roundBigNanoToIncWithTail(bigNano, bigNanoInc, roundingMode, bigNano / bigNanoInc % 2n);
33668
33668
  }
33669
33669
  function roundBigNanoToDayOriginInc(bigNano, bigNanoInc, roundingMode) {
33670
- const [day, timeNano] = divModFloorBigInt(bigNano, bigNanoInUtcDay);
33671
- const dayOriginNano = day * bigNanoInUtcDay;
33670
+ const [day2, timeNano] = divModFloorBigInt(bigNano, bigNanoInUtcDay);
33671
+ const dayOriginNano = day2 * bigNanoInUtcDay;
33672
33672
  return dayOriginNano + roundBigNanoToIncWithTail(timeNano, bigNanoInc, roundingMode, (dayOriginNano / bigNanoInc + timeNano / bigNanoInc) % 2n);
33673
33673
  }
33674
33674
  function roundBigNanoToIncWithTail(bigNano, bigNanoInc, roundingMode, quotientTail) {
@@ -33870,7 +33870,7 @@ function dateAddWithOverflow(calendar, isoDateFields, durationFields, overflow)
33870
33870
  }
33871
33871
  function addDateMonths(calendar, isoDateFields, years, months, overflow) {
33872
33872
  const dateParts = computeCalendarDateFields(calendar, isoDateFields);
33873
- let { year, month, day } = dateParts;
33873
+ let { year, month, day: day2 } = dateParts;
33874
33874
  if (years) {
33875
33875
  const [monthCodeNumber, isLeapMonth] = computeCalendarMonthCodeParts(calendar, year, month);
33876
33876
  year += years, month = computeYearMovedMonth(calendar, monthCodeNumber, isLeapMonth, calendar ? calendar.p(year) : void 0, overflow), month = clampEntity("month", month, 1, computeCalendarMonthsInYearForYear(calendar, year), overflow);
@@ -33879,7 +33879,7 @@ function addDateMonths(calendar, isoDateFields, years, months, overflow) {
33879
33879
  const yearMonthParts = calendar ? calendar.K(year, month, months) : addIsoMonths(year, month, months);
33880
33880
  ({ year, month } = yearMonthParts);
33881
33881
  }
33882
- return day = clampEntity("day", day, 1, computeCalendarDaysInMonthForYearMonth(calendar, year, month), overflow), computeCalendarIsoFieldsFromParts(calendar, year, month, day);
33882
+ return day2 = clampEntity("day", day2, 1, computeCalendarDaysInMonthForYearMonth(calendar, year, month), overflow), computeCalendarIsoFieldsFromParts(calendar, year, month, day2);
33883
33883
  }
33884
33884
  function computeYearMovedMonth(calendar, monthCodeNumber, isLeapMonth, targetLeapMonth, overflow) {
33885
33885
  if (isLeapMonth) {
@@ -34454,31 +34454,31 @@ function createPlainMonthDayFromFields(calendar, fields, options) {
34454
34454
  const monthCodeParts = parseMonthCodeField(fields);
34455
34455
  let yearMaybe = void 0 !== fields.eraYear || void 0 !== fields.year ? resolveCalendarYear(calendar, fields) : void 0;
34456
34456
  const overflow = refineOverflowOptions(options);
34457
- let day;
34457
+ let day2;
34458
34458
  let monthCodeNumber;
34459
34459
  let isLeapMonth;
34460
34460
  if (void 0 === yearMaybe && isIso && (yearMaybe = 1972), void 0 !== yearMaybe) {
34461
34461
  isIso || checkIsoDateInBounds(computeCalendarIsoFieldsFromParts(calendar, yearMaybe, 1, 1));
34462
34462
  const month = resolveCalendarMonth(calendar, fields, yearMaybe, overflow, monthCodeParts);
34463
- day = resolveCalendarDay(calendar, fields, month, yearMaybe, overflow), [monthCodeNumber, isLeapMonth] = computeCalendarMonthCodeParts(calendar, yearMaybe, month);
34463
+ day2 = resolveCalendarDay(calendar, fields, month, yearMaybe, overflow), [monthCodeNumber, isLeapMonth] = computeCalendarMonthCodeParts(calendar, yearMaybe, month);
34464
34464
  } else {
34465
34465
  void 0 === fields.monthCode && throwTypeError("Missing month/monthCode"), [monthCodeNumber, isLeapMonth] = monthCodeParts;
34466
34466
  const referenceYear = calendar ? calendar.ne : 1972;
34467
34467
  if (void 0 !== referenceYear) {
34468
- day = resolveCalendarDay(calendar, fields, resolveCalendarMonth(calendar, fields, referenceYear, overflow, monthCodeParts), referenceYear, overflow);
34468
+ day2 = resolveCalendarDay(calendar, fields, resolveCalendarMonth(calendar, fields, referenceYear, overflow, monthCodeParts), referenceYear, overflow);
34469
34469
  } else {
34470
34470
  const constrainedDay = 0 === overflow && calendar ? calendar.fe?.(monthCodeNumber, isLeapMonth, fields.day) : void 0;
34471
- day = void 0 !== constrainedDay ? constrainedDay : fields.day;
34471
+ day2 = void 0 !== constrainedDay ? constrainedDay : fields.day;
34472
34472
  }
34473
34473
  }
34474
- isLeapMonth && ((calendar && calendar.U?.[monthCodeNumber]) ?? 1 / 0) < fields.day && (1 === overflow && throwRangeError(invalidLeapMonth), isLeapMonth = 0, day = constrainToRange2(fields.day, 1, (calendar && calendar.R) ?? 1 / 0));
34475
- let res = calendar ? calendar.u(monthCodeNumber, Boolean(isLeapMonth), day) : computeIsoYearMonthFieldsForMonthDay(monthCodeNumber, Boolean(isLeapMonth));
34476
- for (; !res && 0 === overflow && day > 1; ) {
34477
- day--, res = calendar ? calendar.u(monthCodeNumber, Boolean(isLeapMonth), day) : computeIsoYearMonthFieldsForMonthDay(monthCodeNumber, Boolean(isLeapMonth));
34474
+ isLeapMonth && ((calendar && calendar.U?.[monthCodeNumber]) ?? 1 / 0) < fields.day && (1 === overflow && throwRangeError(invalidLeapMonth), isLeapMonth = 0, day2 = constrainToRange2(fields.day, 1, (calendar && calendar.R) ?? 1 / 0));
34475
+ let res = calendar ? calendar.u(monthCodeNumber, Boolean(isLeapMonth), day2) : computeIsoYearMonthFieldsForMonthDay(monthCodeNumber, Boolean(isLeapMonth));
34476
+ for (; !res && 0 === overflow && day2 > 1; ) {
34477
+ day2--, res = calendar ? calendar.u(monthCodeNumber, Boolean(isLeapMonth), day2) : computeIsoYearMonthFieldsForMonthDay(monthCodeNumber, Boolean(isLeapMonth));
34478
34478
  }
34479
34479
  res || throwRangeError("Cannot guess year");
34480
34480
  const { year: finalYear, month: finalMonth } = res;
34481
- return createDateSlots(checkIsoDateInBounds(computeCalendarIsoFieldsFromParts(calendar, finalYear, finalMonth, day)), calendar);
34481
+ return createDateSlots(checkIsoDateInBounds(computeCalendarIsoFieldsFromParts(calendar, finalYear, finalMonth, day2)), calendar);
34482
34482
  }
34483
34483
  var RawDateTimeFormat = Intl.DateTimeFormat;
34484
34484
  function formatEpochMilliToPartsRecord(intlFormat, epochMilli) {
@@ -34940,13 +34940,13 @@ function parsePlainMonthDay(s, resolveCalendar) {
34940
34940
  }
34941
34941
  const dateSlots = finalizeDateLike(parsePlainDateLike(s), projectIsoMonthDayDate, resolveCalendar);
34942
34942
  const { calendar } = dateSlots;
34943
- const { year: origYear, month: origMonth, day } = computeCalendarDateFields(calendar, dateSlots);
34943
+ const { year: origYear, month: origMonth, day: day2 } = computeCalendarDateFields(calendar, dateSlots);
34944
34944
  const [monthCodeNumber, isLeapMonth] = computeCalendarMonthCodeParts(calendar, origYear, origMonth);
34945
- const { year, month } = ((calendar2, monthCodeNumber2, isLeapMonth2, day2) => {
34946
- const yearMonthFields = calendar2 ? calendar2.u(monthCodeNumber2, isLeapMonth2, day2) : computeIsoYearMonthFieldsForMonthDay(monthCodeNumber2, isLeapMonth2);
34945
+ const { year, month } = ((calendar2, monthCodeNumber2, isLeapMonth2, day3) => {
34946
+ const yearMonthFields = calendar2 ? calendar2.u(monthCodeNumber2, isLeapMonth2, day3) : computeIsoYearMonthFieldsForMonthDay(monthCodeNumber2, isLeapMonth2);
34947
34947
  return yearMonthFields || throwRangeError("Cannot guess year"), yearMonthFields;
34948
- })(calendar, monthCodeNumber, isLeapMonth, day);
34949
- return createDateSlots(checkIsoDateInBounds(computeCalendarIsoFieldsFromParts(calendar, year, month, day)), calendar);
34948
+ })(calendar, monthCodeNumber, isLeapMonth, day2);
34949
+ return createDateSlots(checkIsoDateInBounds(computeCalendarIsoFieldsFromParts(calendar, year, month, day2)), calendar);
34950
34950
  }
34951
34951
  function parsePlainTime(s) {
34952
34952
  let organized = ((s2) => {
@@ -35007,10 +35007,10 @@ function finalizeDateLike(organized, isoDateProjector, resolveCalendar) {
35007
35007
  return isoDateProjector && "iso8601" === organized.calendarId ? (validateIsoDateFields(organized), organized.re && validateTimeFields(organized), finalizeDate(isoDateProjector(organized), resolveCalendar)) : organized.re ? finalizeDateTime(organized, resolveCalendar) : finalizeDate(organized, resolveCalendar);
35008
35008
  }
35009
35009
  function projectIsoYearMonthDate(organized) {
35010
- const day = 12 * organized.year + organized.month === isoYearMonthIndexMin ? 20 : 1;
35010
+ const day2 = 12 * organized.year + organized.month === isoYearMonthIndexMin ? 20 : 1;
35011
35011
  return {
35012
35012
  ...organized,
35013
- day
35013
+ day: day2
35014
35014
  };
35015
35015
  }
35016
35016
  function projectIsoMonthDayDate(organized) {
@@ -35146,11 +35146,11 @@ function mergeZonedDateTimeFields(zonedDateTimeSlots, modFields, options) {
35146
35146
  const { calendar, timeZone } = zonedDateTimeSlots;
35147
35147
  const validFieldNames = getCalendarFieldNames(calendar, dateTimeAndOffsetFieldNamesAlpha, dateTimeAndOffsetFieldNamesWithEraAlpha);
35148
35148
  const zonedSlots = zonedEpochSlotsToIso(zonedDateTimeSlots);
35149
- const { year, month, day } = computeCalendarDateFields(calendar, zonedSlots);
35149
+ const { year, month, day: day2 } = computeCalendarDateFields(calendar, zonedSlots);
35150
35150
  const origFields = {
35151
35151
  year,
35152
35152
  monthCode: computeMonthCode(calendar, year, month),
35153
- day,
35153
+ day: day2,
35154
35154
  hour: zonedSlots.hour,
35155
35155
  minute: zonedSlots.minute,
35156
35156
  second: zonedSlots.second,
@@ -35171,11 +35171,11 @@ function mergeZonedDateTimeFields(zonedDateTimeSlots, modFields, options) {
35171
35171
  function mergePlainDateTimeFields(plainDateTimeSlots, modFields, options) {
35172
35172
  const { calendar } = plainDateTimeSlots;
35173
35173
  const validFieldNames = getCalendarFieldNames(calendar, dateTimeFieldNamesAlpha, dateTimeFieldNamesWithEraAlpha);
35174
- const { year, month, day } = computeCalendarDateFields(calendar, plainDateTimeSlots);
35174
+ const { year, month, day: day2 } = computeCalendarDateFields(calendar, plainDateTimeSlots);
35175
35175
  const origFields = {
35176
35176
  year,
35177
35177
  monthCode: computeMonthCode(calendar, year, month),
35178
- day,
35178
+ day: day2,
35179
35179
  hour: plainDateTimeSlots.hour,
35180
35180
  minute: plainDateTimeSlots.minute,
35181
35181
  second: plainDateTimeSlots.second,
@@ -35195,11 +35195,11 @@ function mergePlainDateTimeFields(plainDateTimeSlots, modFields, options) {
35195
35195
  function mergePlainDateFields(plainDateSlots, modFields, options) {
35196
35196
  const { calendar } = plainDateSlots;
35197
35197
  const validFieldNames = getCalendarFieldNames(calendar, dateFieldNamesAlpha, dateFieldNamesWithEraAlpha);
35198
- const { year, month, day } = computeCalendarDateFields(calendar, plainDateSlots);
35198
+ const { year, month, day: day2 } = computeCalendarDateFields(calendar, plainDateSlots);
35199
35199
  return createPlainDateFromFields(calendar, mergeCalendarFields(calendar, {
35200
35200
  year,
35201
35201
  monthCode: computeMonthCode(calendar, year, month),
35202
- day
35202
+ day: day2
35203
35203
  }, readAndRefineBagFields(modFields, validFieldNames, dateFieldRefiners)), options);
35204
35204
  }
35205
35205
  function mergePlainYearMonthFields(plainYearMonthSlots, modFields, options) {
@@ -35214,10 +35214,10 @@ function mergePlainYearMonthFields(plainYearMonthSlots, modFields, options) {
35214
35214
  function mergePlainMonthDayFields(plainMonthDaySlots, modFields, options) {
35215
35215
  const { calendar } = plainMonthDaySlots;
35216
35216
  const validFieldNames = getCalendarFieldNames(calendar, dateFieldNamesAlpha, dateFieldNamesWithEraAlpha);
35217
- const { year, month, day } = computeCalendarDateFields(calendar, plainMonthDaySlots);
35217
+ const { year, month, day: day2 } = computeCalendarDateFields(calendar, plainMonthDaySlots);
35218
35218
  return createPlainMonthDayFromFields(calendar, mergeCalendarFields(calendar, {
35219
35219
  monthCode: computeMonthCode(calendar, year, month),
35220
- day
35220
+ day: day2
35221
35221
  }, readAndRefineBagFields(modFields, validFieldNames, dateFieldRefiners)), options);
35222
35222
  }
35223
35223
  function mergePlainTimeFields(initialFields, mod, options) {
@@ -36960,7 +36960,7 @@ function shadowedLinkLineOf({ shadow }) {
36960
36960
  }
36961
36961
 
36962
36962
  // src/rules/cli-version.rules.ts
36963
- var STAMPED = "0.1.97";
36963
+ var STAMPED = "0.1.99";
36964
36964
  function cliVersionOf({ stamped = STAMPED } = {}) {
36965
36965
  return stamped.startsWith("__") ? "dev" : stamped;
36966
36966
  }
@@ -37391,6 +37391,7 @@ var SWITCHES = /* @__PURE__ */ new Set([
37391
37391
  "as-is",
37392
37392
  "save",
37393
37393
  "private",
37394
+ "public",
37394
37395
  "mentions",
37395
37396
  "threads",
37396
37397
  "reactions",
@@ -37449,6 +37450,29 @@ function flagText({
37449
37450
  return typeof value === "string" ? value : fallback;
37450
37451
  }
37451
37452
 
37453
+ // src/rules/linked-profile.rules.ts
37454
+ function slugOf(name3) {
37455
+ return name3.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "") || "agent";
37456
+ }
37457
+ function linkedProfileNameOf({
37458
+ args,
37459
+ linked,
37460
+ profiles: profiles2
37461
+ }) {
37462
+ const wanted = flagText({ args, name: "profile" }) || `agent-${slugOf(linked.agent.name)}`;
37463
+ const free = (name3) => {
37464
+ const held = profiles2[name3];
37465
+ return !held || held.kind === "agent" && held.agentId === linked.agent.id;
37466
+ };
37467
+ if (free(wanted)) return wanted;
37468
+ for (let number4 = 2; ; number4 += 1) {
37469
+ if (free(`${wanted}-${number4}`)) return `${wanted}-${number4}`;
37470
+ }
37471
+ }
37472
+ function revokedKeyLineOf({ profile }) {
37473
+ return `${profile}: this agent's key was revoked: run \`laze agent link\` again or remove it with \`laze logout --profile ${profile}\``;
37474
+ }
37475
+
37452
37476
  // src/rules/refusal-format.rules.ts
37453
37477
  function refusalText({ code, message: message2 }) {
37454
37478
  const sentence = message2.trim().replace(/[.!]*$/, ".");
@@ -61876,6 +61900,37 @@ var vaultAppUseAnswerSchemaDefinition = external_exports.discriminatedUnion("dec
61876
61900
  var count = external_exports.number().nonnegative().max(1e15);
61877
61901
  var countMap = external_exports.record(external_exports.string().max(128), count).nullish().transform((value) => value ?? {});
61878
61902
  var lines = external_exports.array(external_exports.string().max(2e3)).max(200).nullish().transform((value) => value ?? []);
61903
+ var RFC3339 = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d{1,9})?(?:Z|[+-]\d{2}:\d{2})$/;
61904
+ var DAY = /^\d{4}-\d{2}-\d{2}$/;
61905
+ var day = external_exports.string().regex(DAY, "a YYYY-MM-DD day");
61906
+ var workspaceIdText = external_exports.string().max(128);
61907
+ var vaultWatchContentReconcileSchemaDefinition = external_exports.object({
61908
+ day,
61909
+ state: external_exports.enum(["matched", "mismatch", "learning", "failed"]),
61910
+ armed: external_exports.boolean(),
61911
+ tolerance: count,
61912
+ gateUnwraps: count.nullable(),
61913
+ vaultdUnwraps: count.nullable(),
61914
+ vaultdTracked: external_exports.boolean(),
61915
+ /** Unwraps content-gate logged that vaultd did not count: the key used outside Laze. */
61916
+ unaccounted: count,
61917
+ /** Unwraps vaultd counted that content-gate did not log. */
61918
+ missingFromGate: count,
61919
+ workspaces: external_exports.array(external_exports.object({ workspaceId: workspaceIdText, gate: count, vaultd: count })).max(50).nullish().transform((value) => value ?? []),
61920
+ reasons: lines,
61921
+ attempts: external_exports.number().int().min(0),
61922
+ failure: external_exports.string().max(2e3).optional(),
61923
+ checkedAt: external_exports.iso.datetime({ offset: true })
61924
+ });
61925
+ var vaultWatchContentUnwrapsQuerySchemaDefinition = external_exports.object({ day });
61926
+ var vaultWatchContentUnwrapsSchemaDefinition = external_exports.object({
61927
+ day,
61928
+ /** False when vaultd did not count the whole day, so a missing count is not a zero. */
61929
+ tracked: external_exports.boolean(),
61930
+ countingSince: external_exports.string().regex(RFC3339, "an RFC 3339 time").nullable(),
61931
+ total: count,
61932
+ workspaces: external_exports.record(workspaceIdText, count)
61933
+ });
61879
61934
  var vaultWatchThresholdsSchemaDefinition = external_exports.object({
61880
61935
  per10m: count,
61881
61936
  perHour: count,
@@ -61910,7 +61965,8 @@ var vaultWatchReportSchemaDefinition = external_exports.object({
61910
61965
  failures: lines,
61911
61966
  operatorChainLength: external_exports.number().int().min(0).optional(),
61912
61967
  operatorChainHead: external_exports.string().max(128).optional(),
61913
- operatorChainProblem: external_exports.string().max(2e3).optional()
61968
+ operatorChainProblem: external_exports.string().max(2e3).optional(),
61969
+ contentReconcile: vaultWatchContentReconcileSchemaDefinition.nullish().transform((value) => value ?? null)
61914
61970
  });
61915
61971
  var vaultWatchReportReceiptSchemaDefinition = external_exports.object({
61916
61972
  stored: external_exports.boolean(),
@@ -61926,7 +61982,6 @@ var vaultPasskeyAssertionSchemaDefinition = external_exports.object({
61926
61982
  signature: b64url2
61927
61983
  });
61928
61984
  var vaultPasskeyAssertionSchema = vaultPasskeyAssertionSchemaDefinition;
61929
- var RFC3339 = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d{1,9})?(?:Z|[+-]\d{2}:\d{2})$/;
61930
61985
  var vaultWatchOverrideSchemaDefinition = external_exports.object({
61931
61986
  ceilingPerHour: external_exports.number().int().positive().max(1e12),
61932
61987
  /** Kept exactly as signed: the challenge covers these characters. */
@@ -62207,6 +62262,30 @@ function fillCommandReferences({
62207
62262
  };
62208
62263
  }
62209
62264
 
62265
+ // ../../modules/chat/contract/src/chat.close.ts
62266
+ var conversationOpenDaysSchemaDefinition = external_exports.union([external_exports.literal(7), external_exports.literal(14), external_exports.literal(30), external_exports.literal(90)]).nullable();
62267
+ var conversationOpenDaysSchema = conversationOpenDaysSchemaDefinition;
62268
+ var conversationClosedSchemaDefinition = external_exports.object({
62269
+ at: external_exports.iso.datetime(),
62270
+ /** The person who closed it; null when it closed on its own after `afterDays` days. */
62271
+ byId: external_exports.string().nullable(),
62272
+ afterDays: external_exports.number().int().positive().nullable()
62273
+ });
62274
+ var conversationClosedSchema = conversationClosedSchemaDefinition;
62275
+ var conversationPolicySchemaDefinition = external_exports.object({
62276
+ workspaceId: external_exports.string().min(1),
62277
+ /** Days without a message before a conversation closes; null keeps them open. */
62278
+ openDays: conversationOpenDaysSchema
62279
+ });
62280
+ var conversationPolicySchema = conversationPolicySchemaDefinition;
62281
+ var promoteChatInputSchemaDefinition = external_exports.object({
62282
+ workspaceId: external_exports.string().min(1),
62283
+ channelId: external_exports.string().min(1),
62284
+ name: external_exports.string().trim().min(1).max(80),
62285
+ visibility: external_exports.enum(["private", "public"]).default("private")
62286
+ });
62287
+ var chatConversationPolicyTrpc = defineTrpcContract("chat").query("conversationPolicy").withInput(external_exports.object({ workspaceId: external_exports.string().min(1) })).withOutput(conversationPolicySchema).mutation("setConversationPolicy").withInput(conversationPolicySchema).withOutput(conversationPolicySchema).build();
62288
+
62210
62289
  // ../../modules/chat/contract/src/chat.display.ts
62211
62290
  var linkPreviewsSchema = external_exports.enum(["closed", "open"]);
62212
62291
  var readerPreferencesDefinition = external_exports.object({ linkPreviews: linkPreviewsSchema });
@@ -63267,7 +63346,9 @@ var conversationSchemaDefinition = external_exports.object({
63267
63346
  * Direct messages only: the people who left the workspace while in it, no longer members.
63268
63347
  * Spec: modules/chat/specs/departed-person-direct.feature. Absent means no one.
63269
63348
  */
63270
- departed: external_exports.array(departedPersonSchemaDefinition).optional()
63349
+ departed: external_exports.array(departedPersonSchemaDefinition).optional(),
63350
+ /** A conversation with an agent that closed: readable, no new messages. Absent while open. */
63351
+ closed: conversationClosedSchema.nullable().optional()
63271
63352
  });
63272
63353
  var conversationSchema = conversationSchemaDefinition;
63273
63354
  var reachableConversationSchemaDefinition = external_exports.object({
@@ -63401,9 +63482,12 @@ var messageInputSchemaDefinition = external_exports.object({
63401
63482
  messageId: idSchema4
63402
63483
  });
63403
63484
  var messageInputSchema = messageInputSchemaDefinition;
63485
+ var joiningAgentLevelSchema = external_exports.enum(["everything", "mentions"]);
63404
63486
  var addMentionedInputSchemaDefinition = external_exports.object({
63405
63487
  ...messageInputSchemaDefinition.shape,
63406
- agentNames: external_exports.array(external_exports.object({ id: idSchema4, name: external_exports.string().min(1) })).default([])
63488
+ agentNames: external_exports.array(external_exports.object({ id: idSchema4, name: external_exports.string().min(1) })).default([]),
63489
+ /** The joining agents' setting in the channel; Everything when absent. */
63490
+ agentLevel: joiningAgentLevelSchema.optional()
63407
63491
  });
63408
63492
  var addMentionedInputSchema = addMentionedInputSchemaDefinition;
63409
63493
  var createChannelInputSchemaDefinition = external_exports.object({
@@ -63416,7 +63500,9 @@ var createChannelInputSchemaDefinition = external_exports.object({
63416
63500
  /** An agent creator's name, kept on its membership so notices name it. */
63417
63501
  creatorName: external_exports.string().trim().min(1).max(80).optional(),
63418
63502
  /** Sent by older clients and ignored: new channels never end on their own. */
63419
- endsAt: external_exports.iso.datetime().optional()
63503
+ endsAt: external_exports.iso.datetime().optional(),
63504
+ /** The same key on every try of one create: a repeat answers the channel the first one made. */
63505
+ clientKey: external_exports.string().regex(/^[A-Za-z0-9_-]{8,64}$/).optional()
63420
63506
  });
63421
63507
  var createChannelInputSchema = createChannelInputSchemaDefinition;
63422
63508
  var CHANNEL_TOPIC_MAX = 250;
@@ -63458,7 +63544,9 @@ var newMemberSchemaDefinition = external_exports.object({
63458
63544
  runsOutside: external_exports.boolean().optional(),
63459
63545
  /** An agent's owner and whether it is theirs alone or the team's, for its join line. */
63460
63546
  ownerUserId: idSchema4.optional(),
63461
- agentKind: external_exports.enum(["personal", "team"]).optional()
63547
+ agentKind: external_exports.enum(["personal", "team"]).optional(),
63548
+ /** A joining agent's setting in the channel; Everything when absent. */
63549
+ level: joiningAgentLevelSchema.optional()
63462
63550
  });
63463
63551
  var channelGroupInputSchemaDefinition = external_exports.object({
63464
63552
  workspaceId: external_exports.string().min(1),
@@ -63514,7 +63602,9 @@ var openChatInputSchemaDefinition = external_exports.object({
63514
63602
  id: idSchema4,
63515
63603
  name: external_exports.string().min(1).max(80),
63516
63604
  runsOutside: external_exports.boolean().optional()
63517
- })
63605
+ }),
63606
+ /** The first message's client key: the conversation already started with it is answered again. */
63607
+ startKey: external_exports.string().regex(/^[A-Za-z0-9_-]{8,64}$/).optional()
63518
63608
  });
63519
63609
  var renameChatInputSchemaDefinition = external_exports.object({
63520
63610
  workspaceId: workspaceIdSchema,
@@ -63537,7 +63627,9 @@ var chatSummarySchemaDefinition = external_exports.object({
63537
63627
  peopleNames: external_exports.array(external_exports.string()),
63538
63628
  joined: external_exports.boolean(),
63539
63629
  lastMessageAt: external_exports.iso.datetime().nullable(),
63540
- createdAt: external_exports.iso.datetime()
63630
+ createdAt: external_exports.iso.datetime(),
63631
+ /** When it closed; absent while it is open. */
63632
+ closedAt: external_exports.iso.datetime().optional()
63541
63633
  });
63542
63634
  var chatSummarySchema = chatSummarySchemaDefinition;
63543
63635
  var openAgentDirectInputSchemaDefinition = external_exports.object({
@@ -64446,6 +64538,7 @@ var chatPresenceTrpc = defineTrpcContract("chat").mutation("heartbeat").withInpu
64446
64538
  var chatTrpc = joinTrpcContracts(
64447
64539
  "chat",
64448
64540
  chatEmojiTrpc,
64541
+ chatConversationPolicyTrpc,
64449
64542
  chatConversationsTrpc,
64450
64543
  chatChannelRolesTrpc,
64451
64544
  chatMessagesTrpc,
@@ -67412,6 +67505,20 @@ var renameConversationAsCallerInputSchemaDefinition = external_exports.object({
67412
67505
  title: chatTitleSchema
67413
67506
  });
67414
67507
  var conversationAsCallerInputSchemaDefinition = external_exports.object({ channel: idSchema7 });
67508
+ var convertConversationInputSchemaDefinition = external_exports.object({
67509
+ workspaceId: workspaceIdSchema4,
67510
+ channelId: idSchema7,
67511
+ name: external_exports.string().trim().min(1).max(80),
67512
+ visibility: external_exports.enum(["private", "public"]).default("private")
67513
+ });
67514
+ var convertConversationInputSchema = convertConversationInputSchemaDefinition;
67515
+ var convertConversationAsCallerInputSchemaDefinition = external_exports.object({
67516
+ channel: idSchema7,
67517
+ name: external_exports.string().trim().min(1).max(80),
67518
+ visibility: external_exports.enum(["private", "public"]).default("private")
67519
+ });
67520
+ var convertedConversationSchemaDefinition = external_exports.object({ channelId: idSchema7 });
67521
+ var convertedConversationSchema = convertedConversationSchemaDefinition;
67415
67522
  var NAMING_FREE_CLI_COMMANDS = [
67416
67523
  "conversation rename",
67417
67524
  "conversation list",
@@ -69633,7 +69740,9 @@ var inboxMessageSchemaDefinition = external_exports.object({
69633
69740
  });
69634
69741
  var receiveInboxInputSchemaDefinition = external_exports.object({
69635
69742
  waitSeconds: external_exports.coerce.number().int().min(0).max(INBOX_WAIT_MAX_SECONDS).default(0),
69636
- limit: external_exports.coerce.number().int().min(1).max(50).default(20)
69743
+ limit: external_exports.coerce.number().int().min(1).max(50).default(20),
69744
+ /** A one-off take by hand (`laze inbox`): nothing keeps listening, so it never shows online. */
69745
+ byHand: external_exports.boolean().optional()
69637
69746
  });
69638
69747
  var inboxWaitingSchemaDefinition = external_exports.object({
69639
69748
  count: external_exports.number().int().min(0),
@@ -69885,6 +69994,7 @@ var agentRunsOnTrpc = defineTrpcContract("agents").mutation("setRunsOn").withInp
69885
69994
  var agentWelcomeTrpc = defineTrpcContract("agents").mutation("pressWelcome").withInput(pressWelcomeInputSchema).withOutput(pressedWelcomeSchema).mutation("pressCollab").withInput(pressCollabInputSchema).withOutput(pressedCollabSchema).build();
69886
69995
  var agentPoolGroupTrpc = defineTrpcContract("agents").mutation("addPoolGroup").withInput(poolGroupInputSchema).withOutput(loginPoolsSchema).mutation("removePoolGroup").withInput(poolGroupInputSchema).withOutput(loginPoolsSchema).build();
69887
69996
  var agentOpenConversationTrpc = defineTrpcContract("agents").mutation("openConversation").withInput(openConversationInputSchema).withOutput(external_exports.object({ channelId: idSchema17 })).build();
69997
+ var agentConversationCloseTrpc = defineTrpcContract("agents").mutation("closeConversation").withInput(conversationInputSchema).withOutput(conversationSummarySchema2).mutation("reopenConversation").withInput(conversationInputSchema).withOutput(conversationSummarySchema2).mutation("convertConversation").withInput(convertConversationInputSchema).withOutput(convertedConversationSchema).build();
69888
69998
  var agentReconnectTrpc = defineTrpcContract("agents").query("reconnect").withInput(external_exports.object({ workspaceId: workspaceIdSchema14, agentId: idSchema17 })).withOutput(agentReconnectSchema).build();
69889
69999
  var agentTrpc = joinTrpcContracts(
69890
70000
  "agents",
@@ -69892,6 +70002,7 @@ var agentTrpc = joinTrpcContracts(
69892
70002
  agentPoolGroupTrpc,
69893
70003
  agentReconnectTrpc,
69894
70004
  agentOpenConversationTrpc,
70005
+ agentConversationCloseTrpc,
69895
70006
  agentTurnTrpc,
69896
70007
  agentChannelSettingsTrpc,
69897
70008
  agentJoinTrpc,
@@ -70325,7 +70436,9 @@ var createChannelAsCallerInputSchemaDefinition = external_exports.object({
70325
70436
  visibility: external_exports.enum(["public", "private"]).default("public"),
70326
70437
  topic: external_exports.string().trim().max(250).default(""),
70327
70438
  /** Sent by older CLIs and ignored: new channels never end on their own. */
70328
- temporary: external_exports.enum(CALLER_CHANNEL_DURATIONS).optional()
70439
+ temporary: external_exports.enum(CALLER_CHANNEL_DURATIONS).optional(),
70440
+ /** One key per `laze channel create`: a retry answers the channel the first try made. */
70441
+ clientKey: external_exports.string().regex(/^[A-Za-z0-9_-]{8,64}$/).optional()
70329
70442
  });
70330
70443
  var extendChannelAsCallerInputSchemaDefinition = external_exports.object({
70331
70444
  channel: channelRefSchema,
@@ -70783,27 +70896,22 @@ var agentProfileUi = uiTokens("agent");
70783
70896
  var AgentProfileSlot = agentProfileUi.component("profile");
70784
70897
  var AgentOwnedListSlot = agentProfileUi.component("ownedList");
70785
70898
 
70786
- // src/rules/linked-profile.rules.ts
70787
- function slugOf(name3) {
70788
- return name3.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "") || "agent";
70789
- }
70790
- function linkedProfileNameOf({
70791
- args,
70792
- linked,
70793
- profiles: profiles2
70794
- }) {
70795
- const wanted = flagText({ args, name: "profile" }) || `agent-${slugOf(linked.agent.name)}`;
70796
- const free = (name3) => {
70797
- const held = profiles2[name3];
70798
- return !held || held.kind === "agent" && held.agentId === linked.agent.id;
70799
- };
70800
- if (free(wanted)) return wanted;
70801
- for (let number4 = 2; ; number4 += 1) {
70802
- if (free(`${wanted}-${number4}`)) return `${wanted}-${number4}`;
70803
- }
70899
+ // src/rules/key-refusal.rules.ts
70900
+ var KEY_REFUSAL_CODES = /* @__PURE__ */ new Set([
70901
+ "unauthorized",
70902
+ "invalid_credentials",
70903
+ "machine_key_burst_revoked"
70904
+ ]);
70905
+ var KEY_REFUSAL_MESSAGES = /* @__PURE__ */ new Set([
70906
+ "This API key is not valid",
70907
+ "Invalid credentials.",
70908
+ "This CLI key read too much in a minute, so Laze revoked it; sign in again with laze login"
70909
+ ]);
70910
+ function refusesTheKey({ status: status11, code }) {
70911
+ return status11 === 401 && KEY_REFUSAL_CODES.has(code);
70804
70912
  }
70805
- function revokedKeyLineOf({ profile }) {
70806
- return `${profile}: this agent's key was revoked: run \`laze agent link\` again or remove it with \`laze logout --profile ${profile}\``;
70913
+ function markRefusesTheKey({ mark }) {
70914
+ return mark.code ? KEY_REFUSAL_CODES.has(mark.code) : KEY_REFUSAL_MESSAGES.has(mark.message);
70807
70915
  }
70808
70916
 
70809
70917
  // src/rules/session-headers.rules.ts
@@ -70865,7 +70973,8 @@ var LazeClient = class _LazeClient {
70865
70973
  token: token2,
70866
70974
  fetcher,
70867
70975
  onMigrated,
70868
- onRefused
70976
+ onRefused,
70977
+ onAnswered
70869
70978
  }) {
70870
70979
  return new _LazeClient({
70871
70980
  baseUrl: baseUrl.replace(/\/+$/, ""),
@@ -70873,7 +70982,8 @@ var LazeClient = class _LazeClient {
70873
70982
  fetcher,
70874
70983
  headers: {},
70875
70984
  onMigrated,
70876
- onRefused
70985
+ onRefused,
70986
+ onAnswered
70877
70987
  });
70878
70988
  }
70879
70989
  /** The same client, sending these headers too on every call. */
@@ -70915,7 +71025,7 @@ var LazeClient = class _LazeClient {
70915
71025
  const found = migratedNoticeOf(error63);
70916
71026
  if (found && this.options.onMigrated)
70917
71027
  await this.options.onMigrated(found).catch(() => void 0);
70918
- else if (!found && error63.status === 401 && !error63.code.startsWith("http_") && this.options.onRefused)
71028
+ else if (!found && refusesTheKey(error63) && this.options.onRefused)
70919
71029
  await this.options.onRefused(error63).catch(() => void 0);
70920
71030
  }
70921
71031
  async send({
@@ -70943,6 +71053,7 @@ var LazeClient = class _LazeClient {
70943
71053
  await this.toldMigrated(error63);
70944
71054
  throw error63;
70945
71055
  }
71056
+ if (this.options.onAnswered) await this.options.onAnswered().catch(() => void 0);
70946
71057
  return text3 ? JSON.parse(text3) : void 0;
70947
71058
  }
70948
71059
  };
@@ -71080,14 +71191,28 @@ function markRefusedOn({
71080
71191
  token: token2
71081
71192
  }) {
71082
71193
  return async (error63) => {
71083
- const refused = { at: context.nowMs(), message: error63.message };
71194
+ const refused = { at: context.nowMs(), code: error63.code, message: error63.message };
71084
71195
  const marked = await context.store.markRefused({ name: profile, token: token2, refused });
71085
71196
  if (marked) context.err(`${revokedKeyLineOf({ profile })}
71086
71197
  `);
71087
71198
  };
71088
71199
  }
71089
71200
  function refusedRecently({ profile, nowMs: nowMs2 }) {
71090
- return profile.refused !== void 0 && nowMs2 - profile.refused.at < REFUSED_RECHECK_MS;
71201
+ const mark = profile.refused;
71202
+ if (!mark || !markRefusesTheKey({ mark })) return false;
71203
+ return nowMs2 - mark.at < REFUSED_RECHECK_MS;
71204
+ }
71205
+ function clearRefusedOn({
71206
+ context,
71207
+ profile,
71208
+ token: token2
71209
+ }) {
71210
+ let cleared = false;
71211
+ return async () => {
71212
+ if (cleared) return;
71213
+ cleared = true;
71214
+ await context.store.markRefused({ name: profile, token: token2, refused: void 0 });
71215
+ };
71091
71216
  }
71092
71217
  function quietWhenMigrated({ args }) {
71093
71218
  const [first = "", second = ""] = args.words;
@@ -71143,7 +71268,8 @@ async function signedIn({
71143
71268
  token: token2,
71144
71269
  fetcher: context.fetcher,
71145
71270
  onMigrated: markMigratedOn({ context, profile: chosen.name }),
71146
- ...turn ? {} : { onRefused: markRefusedOn({ context, profile: chosen.name, token: token2 }) }
71271
+ onRefused: markRefusedOn({ context, profile: chosen.name, token: token2 }),
71272
+ ...chosen.profile.refused ? { onAnswered: clearRefusedOn({ context, profile: chosen.name, token: token2 }) } : {}
71147
71273
  });
71148
71274
  if (quiet && chosen.profile.refused) await askedAgain({ context, name: chosen.name, client });
71149
71275
  if (chosen.profile.kind !== "agent")
@@ -71168,7 +71294,7 @@ async function askedAgain({
71168
71294
  try {
71169
71295
  await client.get("/api/agents/me");
71170
71296
  } catch (error63) {
71171
- if (error63.status === 401) throw new ProfileRefusedError(name3);
71297
+ if (refusesTheKey(error63)) throw new ProfileRefusedError(name3);
71172
71298
  return;
71173
71299
  }
71174
71300
  if (profile) await context.store.markRefused({ name: name3, token: profile.token, refused: void 0 });
@@ -72739,8 +72865,7 @@ function rushSessionOf({
72739
72865
  }) {
72740
72866
  if (!parentArgs) return void 0;
72741
72867
  const [program = "", verb, action, id4] = parentArgs;
72742
- const isRush = program === "rush" || program.endsWith("/rush");
72743
- if (!isRush || verb !== "host" || action !== "run" || !id4) return void 0;
72868
+ if (!program || verb !== "host" || action !== "run" || !id4) return void 0;
72744
72869
  return { id: id4, program };
72745
72870
  }
72746
72871
  function rushSendCommand({ program, id: id4 }) {
@@ -73265,6 +73390,11 @@ async function preToolHook({ context, args }) {
73265
73390
  })
73266
73391
  );
73267
73392
  } catch (error63) {
73393
+ if (error63 instanceof ProfileRefusedError) {
73394
+ context.err(`${revokedKeyLineOf({ profile: error63.profile })}
73395
+ `);
73396
+ return;
73397
+ }
73268
73398
  if (error63 instanceof ProfileMigratedError) return;
73269
73399
  const migrated = migratedNoticeOf(error63);
73270
73400
  context.err(
@@ -73905,14 +74035,16 @@ async function reply({
73905
74035
  async function receiveMessages({
73906
74036
  context,
73907
74037
  client,
73908
- waitSeconds
74038
+ waitSeconds,
74039
+ byHand = false
73909
74040
  }) {
73910
74041
  const deadline = context.nowMs() + waitSeconds * 1e3;
73911
74042
  let remaining = waitSeconds;
73912
74043
  for (let round = 0; round === 0 || remaining > 0; round += 1) {
73913
74044
  const wait = Math.max(0, Math.min(REQUEST_WAIT_SECONDS, Math.ceil(remaining)));
73914
74045
  const messages = await client.post("/api/agents/me/inbox", {
73915
- waitSeconds: wait
74046
+ waitSeconds: wait,
74047
+ ...byHand ? { byHand: true } : {}
73916
74048
  });
73917
74049
  if (messages.length > 0) return messages;
73918
74050
  remaining = Number.isFinite(waitSeconds) ? (deadline - context.nowMs()) / 1e3 : Infinity;
@@ -73946,7 +74078,8 @@ async function inbox({ context, args }) {
73946
74078
  const { client, name: name3, profile } = await signedIn({ context, args });
73947
74079
  if (profile.kind === "agent") await refuseOtherSessionsInbox({ context, args, name: name3, client });
73948
74080
  const waitSeconds = waitSecondsOf({ args });
73949
- const messages = await receiveMessages({ context, client, waitSeconds });
74081
+ const byHand = !args.flags.wait;
74082
+ const messages = await receiveMessages({ context, client, waitSeconds, byHand });
73950
74083
  if (profile.kind === "agent" && context.environment.harness === "claude-code") {
73951
74084
  await turnStarted({ context, client, agent: name3, messages }).catch(() => void 0);
73952
74085
  }
@@ -76185,9 +76318,7 @@ async function waitForMessages({ context, args }) {
76185
76318
  const named = await sessionProfileArgs({ context, args: asked, session });
76186
76319
  const { client, name: name3 } = await signedIn({ context, args: named });
76187
76320
  await rememberSession({ context, claudePid, session });
76188
- const rush = rushSessionOf({
76189
- parentArgs: await context.processes.argsOf(await context.processes.parentOf(claudePid) ?? 0)
76190
- });
76321
+ const rush = claudePid ? await rushAboveOf({ context, from: claudePid }) : void 0;
76191
76322
  if (rush) await startRushGuard({ context, profile: name3, claudePid, rush });
76192
76323
  if (rush) await healRushDelivery({ context });
76193
76324
  const lock = statePathOf({ context, kind: "waiters", profile: name3 });
@@ -76241,13 +76372,17 @@ async function refusedOnce({
76241
76372
  args,
76242
76373
  error: error63
76243
76374
  }) {
76244
- const profile = String(args.flags.profile ?? "default");
76375
+ const profile = error63 instanceof ProfileRefusedError ? error63.profile : String(args.flags.profile ?? "default");
76245
76376
  const path = statePathOf({ context, kind: "told", profile: `refused-${profile}` });
76246
76377
  const told = await readFile9(path, "utf8").then(
76247
76378
  () => true,
76248
76379
  () => false
76249
76380
  );
76250
- if (told) return 0;
76381
+ if (told) {
76382
+ context.err(`${revokedKeyLineOf({ profile })}
76383
+ `);
76384
+ return 0;
76385
+ }
76251
76386
  await writeStateText({ path, text: String(context.nowMs()) });
76252
76387
  context.err(
76253
76388
  `Laze: Laze refused this agent's key (${String(error63)}), so messages no longer reach this session. Link it again: laze agent link.
@@ -76275,6 +76410,7 @@ async function waitHook({ context, args }) {
76275
76410
  try {
76276
76411
  return await waitForMessages({ context, args });
76277
76412
  } catch (error63) {
76413
+ if (error63 instanceof ProfileRefusedError) return refusedOnce({ context, args, error: error63 });
76278
76414
  if (error63 instanceof ProfileMigratedError) return 0;
76279
76415
  const migrated = migratedNoticeOf(error63);
76280
76416
  if (migrated) {
@@ -77166,17 +77302,29 @@ async function listenAfterLink({
77166
77302
  profile,
77167
77303
  claudePid
77168
77304
  }) {
77169
- if (!claudePid) return;
77170
- const parent = await context.processes.parentOf(claudePid) ?? 0;
77171
- const rush = rushSessionOf({ parentArgs: await context.processes.argsOf(parent) });
77172
- if (!rush) return;
77305
+ if (!claudePid) return await liveListenerOf({ context, profile }) ? "listening" : "none";
77173
77306
  const session = await currentSessionOf({ context, args });
77174
77307
  await rememberSession({ context, claudePid, session });
77308
+ const rush = await rushAboveOf({ context, from: claudePid });
77309
+ if (!rush) return await liveListenerOf({ context, profile }) ? "listening" : "none";
77175
77310
  await startRushGuard({ context, profile, claudePid, rush });
77176
77311
  await ensureConnectService({ context }).catch((error63) => {
77177
77312
  context.err(`laze: could not start the connect service: ${String(error63)}
77178
77313
  `);
77179
77314
  });
77315
+ return "host";
77316
+ }
77317
+ async function liveListenerOf({ context, profile }) {
77318
+ const holder = await holderOf({ path: statePathOf({ context, kind: "waiters", profile }) });
77319
+ return holder !== void 0 && context.processes.alive(holder.pid);
77320
+ }
77321
+ function noListenerLinesOf({ laze, profile }) {
77322
+ return [
77323
+ "No listener runs in this session yet, so messages wait in Laze until one does.",
77324
+ "Start one in this session now: run this with the Monitor tool, persistent, so each message reaches you as it comes:",
77325
+ ` ${laze} hook monitor --profile ${profile}`,
77326
+ "Or resume this session (claude --resume), which starts the Laze hooks."
77327
+ ];
77180
77328
  }
77181
77329
 
77182
77330
  // src/services/mcp-channel.service.ts
@@ -77405,8 +77553,23 @@ async function listAgents({ context, args }) {
77405
77553
  if (wanted && shown2.length === 0) throw new CliUsageError(`No agent named ${wanted}.`);
77406
77554
  if (args.flags.json) return context.out(`${JSON.stringify(shown2, null, 2)}
77407
77555
  `);
77408
- for (const agent3 of shown2) context.out(`${lineOf(agent3)}
77556
+ const refused = await refusedHereOf({ context });
77557
+ for (const agent3 of shown2) {
77558
+ const here = refused.get(agent3.id);
77559
+ const note = here ? ` key refused on this machine (profile ${here}): its hooks deliver nothing` : "";
77560
+ context.out(`${lineOf(agent3)}${note}
77409
77561
  `);
77562
+ }
77563
+ }
77564
+ async function refusedHereOf({ context }) {
77565
+ const { profiles: profiles2 } = await context.store.read();
77566
+ const refused = /* @__PURE__ */ new Map();
77567
+ for (const [name3, profile] of Object.entries(profiles2)) {
77568
+ const mark = profile.refused;
77569
+ if (!profile.agentId || !mark || !markRefusesTheKey({ mark })) continue;
77570
+ refused.set(profile.agentId, name3);
77571
+ }
77572
+ return refused;
77410
77573
  }
77411
77574
  async function showAgent({ context, args }) {
77412
77575
  const wanted = args.words[2];
@@ -77606,7 +77769,7 @@ async function settleLinked({
77606
77769
  }
77607
77770
  const hooked = claude && !args.flags["no-hook"];
77608
77771
  const hookPath = hooked ? await installHooks({ context, directory, profile: name3 }) : void 0;
77609
- if (hooked) await listenAfterLink({ context, args, profile: name3, claudePid: pid });
77772
+ const listener = hooked ? await listenAfterLink({ context, args, profile: name3, claudePid: pid }) : void 0;
77610
77773
  const { command: laze, shadow } = await rerunCommandOf({ context });
77611
77774
  const steps = await nextStepsFor({
77612
77775
  context,
@@ -77625,6 +77788,7 @@ async function settleLinked({
77625
77788
  ...shadowedLinkLineOf({ shadow }),
77626
77789
  "",
77627
77790
  steps,
77791
+ ...listener === "none" ? ["", ...noListenerLinesOf({ laze, profile: name3 })] : [],
77628
77792
  ""
77629
77793
  ].join("\n")
77630
77794
  );
@@ -77777,6 +77941,11 @@ async function stopHook({ context, args }) {
77777
77941
  try {
77778
77942
  await handOver({ context, args });
77779
77943
  } catch (error63) {
77944
+ if (error63 instanceof ProfileRefusedError) {
77945
+ context.err(`${revokedKeyLineOf({ profile: error63.profile })}
77946
+ `);
77947
+ return;
77948
+ }
77780
77949
  if (error63 instanceof ProfileMigratedError) return;
77781
77950
  const migrated = migratedNoticeOf(error63);
77782
77951
  if (migrated) return stopContext({ context, text: migrated.notice });
@@ -79021,8 +79190,30 @@ async function bindAgentSession({
79021
79190
  await context.store.bindSession({ session: key, profile: name3 });
79022
79191
  const where = `profile ${name3}, config ${context.environment.configPath}`;
79023
79192
  const from = own2 && own2 !== name3 ? ` It moved from "${config2.profiles[own2]?.name}".` : "";
79024
- context.out(`"${profile.name}" now listens in this session (${where}).${from}
79193
+ const listener = await listenerOfBound({ context, args, name: name3, harness: session.harness });
79194
+ if (listener !== "none") {
79195
+ context.out(`"${profile.name}" now listens in this session (${where}).${from}
79025
79196
  `);
79197
+ return;
79198
+ }
79199
+ const { command: laze } = await rerunCommandOf({ context });
79200
+ const lines2 = noListenerLinesOf({ laze, profile: name3 });
79201
+ context.out(
79202
+ `"${profile.name}" is bound to this session (${where}).${from}
79203
+ ${lines2.join("\n")}
79204
+ `
79205
+ );
79206
+ }
79207
+ async function listenerOfBound({
79208
+ context,
79209
+ args,
79210
+ name: name3,
79211
+ harness
79212
+ }) {
79213
+ if (harness !== "claude-code") return "host";
79214
+ const claude = await nearestHarnessOf({ context });
79215
+ const claudePid = claude?.harness === "claude-code" ? claude.pid : void 0;
79216
+ return listenAfterLink({ context, args, profile: name3, claudePid });
79026
79217
  }
79027
79218
  async function mintedRequestProfile({
79028
79219
  context,
@@ -80052,12 +80243,28 @@ var appDoorSchemaDefinition = external_exports.object({
80052
80243
  requestedAt: external_exports.iso.datetime().nullable()
80053
80244
  });
80054
80245
  var appDoorSchema = appDoorSchemaDefinition;
80246
+ var appOpenChoiceSchemaDefinition = external_exports.object({
80247
+ workspaceId: external_exports.string().min(1),
80248
+ workspaceName: external_exports.string(),
80249
+ name: external_exports.string()
80250
+ });
80251
+ var appOpenChoicesSchemaDefinition = external_exports.object({
80252
+ viewer: external_exports.object({ name: external_exports.string(), email: external_exports.string() }),
80253
+ choices: external_exports.array(appOpenChoiceSchemaDefinition),
80254
+ /** Set once they asked and no one answered yet. */
80255
+ requestedAt: external_exports.iso.datetime().nullable()
80256
+ });
80257
+ var appOpenChoicesSchema = appOpenChoicesSchemaDefinition;
80258
+ var appAskedSchemaDefinition = external_exports.object({ asked: external_exports.literal(true) });
80259
+ var appAskedSchema = appAskedSchemaDefinition;
80055
80260
  var pendingAppAccessSchemaDefinition = external_exports.object({
80056
80261
  ...appAccessRequestSchemaDefinition.shape,
80057
80262
  workspaceId: external_exports.string().min(1),
80058
80263
  appName: external_exports.string(),
80059
80264
  /** The role a grant from the feed card gives. */
80060
80265
  memberRole: appRoleSchema,
80266
+ /** Set when the person is not in the workspace: approving adds them as a Guest. */
80267
+ outsider: external_exports.boolean().optional(),
80061
80268
  /** The Builders who answer it; for an agent's request, the agent's owner only. */
80062
80269
  builderUserIds: external_exports.array(external_exports.string()),
80063
80270
  /** Set for an agent's request: whose it is and how approving adds it. */
@@ -80806,7 +81013,7 @@ var appsCopy = {
80806
81013
  paintOnly: true,
80807
81014
  storable: appsForDisk
80808
81015
  };
80809
- var appMainTrpc = defineTrpcContract("app").query("list", { mirrored: appsCopy }).withInput(listAppsInputSchema).withOutput(external_exports.array(appSchema)).query("get").withInput(appRefSchema).withOutput(appSchema).mutation("create").withInput(createAppInputSchema).withOutput(appSchema).mutation("rename").withInput(renameAppInputSchema).withOutput(appSchema).mutation("archive").withInput(appRefSchema).withOutput(appSchema).mutation("unarchive").withInput(appRefSchema).withOutput(appSchema).mutation("delete").withInput(deleteAppInputSchema).withOutput(external_exports.object({ deleted: external_exports.literal(true) })).query("versions").withInput(appRefSchema).withOutput(external_exports.array(appVersionSchema)).mutation("revert").withInput(revertInputSchema).withOutput(appPushSchema).mutation("publish").withInput(publishInputSchema).withOutput(publishOutcomeSchema).query("collections").withInput(appDataRefSchema).withOutput(external_exports.array(collectionSchema)).query("records").withInput(listRecordsInputSchema).withOutput(recordPageSchema).mutation("writeRecord").withInput(writeRecordInputSchema).withOutput(appRecordSchema).mutation("deleteRecord").withInput(deleteRecordInputSchema).withOutput(external_exports.object({ deleted: external_exports.literal(true) })).query("views").withInput(appDataRefSchema).withOutput(external_exports.array(appViewSchema)).mutation("saveView").withInput(saveViewInputSchema).withOutput(appViewSchema).mutation("deleteView").withInput(deleteViewInputSchema).withOutput(external_exports.object({ deleted: external_exports.literal(true) })).mutation("chooseCardRows").withInput(chooseCardRowsInputSchema).withOutput(appCardChoiceSchema).query("exportRecords").withInput(exportRecordsInputSchema).withOutput(recordExportSchema).mutation("importRecords").withInput(importRecordsInputSchema).withOutput(recordImportSchema).mutation("decidePublish").withInput(decidePublishInputSchema).withOutput(publishOutcomeSchema).mutation("nameVersion").withInput(nameVersionInputSchema).withOutput(appVersionSchema).mutation("makeInternal").withInput(appRefSchema).withOutput(appSchema).mutation("revokePublishLease").withInput(appRefSchema).withOutput(appSchema).mutation("signInHandoff").withInput(signInHandoffInputSchema).withOutput(signInHandoffSchema).query("functionLogs").withInput(listFunctionLogsInputSchema).withOutput(external_exports.array(appFunctionLogEntrySchema)).query("access").withInput(appRefSchema).withOutput(appAccessSchema).query("members").withInput(appRefSchema).withOutput(appMembersSchema).mutation("grantAccess").withInput(grantAppAccessInputSchema).withOutput(appAccessSchema).mutation("revokeAccess").withInput(revokeAppAccessInputSchema).withOutput(appAccessSchema).mutation("setVisibility").withInput(setAppVisibilityInputSchema).withOutput(visibilityOutcomeSchema).mutation("setMemberRole").withInput(setMemberRoleInputSchema).withOutput(appAccessSchema).mutation("unpublish").withInput(appRefSchema).withOutput(appSchema).query("door").withInput(appRefSchema).withOutput(appDoorSchema).mutation("requestAccess").withInput(appRefSchema).withOutput(appDoorSchema).mutation("decideAccess").withInput(decideAppAccessInputSchema).withOutput(appAccessRequestSchema).query("users").withInput(appRefSchema).withOutput(appUsersSchema).mutation("blockUser").withInput(blockAppUserInputSchema).withOutput(appUsersSchema).mutation("deleteUser").withInput(deleteAppUserInputSchema).withOutput(deletedAppUserSchema).query("backups").withInput(appRefSchema).withOutput(appBackupStatusSchema).mutation("restoreData").withInput(restoreAppDataInputSchema).withOutput(appRestoreSchema).query("cost").withInput(appRefSchema).withOutput(appCostSchema).mutation("setBudget").withInput(setAppBudgetInputSchema).withOutput(appCostSchema).query("triggers").withInput(appRefSchema).withOutput(appTriggersSchema).mutation("setTriggerPaused").withInput(setAppTriggerPausedInputSchema).withOutput(appTriggerSchema).mutation("removeTrigger").withInput(appTriggerRefSchema).withOutput(external_exports.object({ removed: external_exports.literal(true) })).build();
81016
+ var appMainTrpc = defineTrpcContract("app").query("list", { mirrored: appsCopy }).withInput(listAppsInputSchema).withOutput(external_exports.array(appSchema)).query("get").withInput(appRefSchema).withOutput(appSchema).mutation("create").withInput(createAppInputSchema).withOutput(appSchema).mutation("rename").withInput(renameAppInputSchema).withOutput(appSchema).mutation("archive").withInput(appRefSchema).withOutput(appSchema).mutation("unarchive").withInput(appRefSchema).withOutput(appSchema).mutation("delete").withInput(deleteAppInputSchema).withOutput(external_exports.object({ deleted: external_exports.literal(true) })).query("versions").withInput(appRefSchema).withOutput(external_exports.array(appVersionSchema)).mutation("revert").withInput(revertInputSchema).withOutput(appPushSchema).mutation("publish").withInput(publishInputSchema).withOutput(publishOutcomeSchema).query("collections").withInput(appDataRefSchema).withOutput(external_exports.array(collectionSchema)).query("records").withInput(listRecordsInputSchema).withOutput(recordPageSchema).mutation("writeRecord").withInput(writeRecordInputSchema).withOutput(appRecordSchema).mutation("deleteRecord").withInput(deleteRecordInputSchema).withOutput(external_exports.object({ deleted: external_exports.literal(true) })).query("views").withInput(appDataRefSchema).withOutput(external_exports.array(appViewSchema)).mutation("saveView").withInput(saveViewInputSchema).withOutput(appViewSchema).mutation("deleteView").withInput(deleteViewInputSchema).withOutput(external_exports.object({ deleted: external_exports.literal(true) })).mutation("chooseCardRows").withInput(chooseCardRowsInputSchema).withOutput(appCardChoiceSchema).query("exportRecords").withInput(exportRecordsInputSchema).withOutput(recordExportSchema).mutation("importRecords").withInput(importRecordsInputSchema).withOutput(recordImportSchema).mutation("decidePublish").withInput(decidePublishInputSchema).withOutput(publishOutcomeSchema).mutation("nameVersion").withInput(nameVersionInputSchema).withOutput(appVersionSchema).mutation("makeInternal").withInput(appRefSchema).withOutput(appSchema).mutation("revokePublishLease").withInput(appRefSchema).withOutput(appSchema).mutation("signInHandoff").withInput(signInHandoffInputSchema).withOutput(signInHandoffSchema).query("functionLogs").withInput(listFunctionLogsInputSchema).withOutput(external_exports.array(appFunctionLogEntrySchema)).query("access").withInput(appRefSchema).withOutput(appAccessSchema).query("members").withInput(appRefSchema).withOutput(appMembersSchema).mutation("grantAccess").withInput(grantAppAccessInputSchema).withOutput(appAccessSchema).mutation("revokeAccess").withInput(revokeAppAccessInputSchema).withOutput(appAccessSchema).mutation("setVisibility").withInput(setAppVisibilityInputSchema).withOutput(visibilityOutcomeSchema).mutation("setMemberRole").withInput(setMemberRoleInputSchema).withOutput(appAccessSchema).mutation("unpublish").withInput(appRefSchema).withOutput(appSchema).query("door").withInput(appRefSchema).withOutput(appDoorSchema).mutation("requestAccess").withInput(appRefSchema).withOutput(appDoorSchema).query("openChoices").withInput(appRefSchema).withOutput(appOpenChoicesSchema).mutation("askToOpen").withInput(appRefSchema).withOutput(appAskedSchema).mutation("decideAccess").withInput(decideAppAccessInputSchema).withOutput(appAccessRequestSchema).query("users").withInput(appRefSchema).withOutput(appUsersSchema).mutation("blockUser").withInput(blockAppUserInputSchema).withOutput(appUsersSchema).mutation("deleteUser").withInput(deleteAppUserInputSchema).withOutput(deletedAppUserSchema).query("backups").withInput(appRefSchema).withOutput(appBackupStatusSchema).mutation("restoreData").withInput(restoreAppDataInputSchema).withOutput(appRestoreSchema).query("cost").withInput(appRefSchema).withOutput(appCostSchema).mutation("setBudget").withInput(setAppBudgetInputSchema).withOutput(appCostSchema).query("triggers").withInput(appRefSchema).withOutput(appTriggersSchema).mutation("setTriggerPaused").withInput(setAppTriggerPausedInputSchema).withOutput(appTriggerSchema).mutation("removeTrigger").withInput(appTriggerRefSchema).withOutput(external_exports.object({ removed: external_exports.literal(true) })).build();
80810
81017
  var appConnectionsTrpc = defineTrpcContract("app").query("connections").withInput(appRefSchema).withOutput(appConnectionsSchema).mutation("allowConnection").withInput(appConnectionRefSchema).withOutput(appConnectionsSchema).mutation("revokeConnection").withInput(appConnectionRefSchema).withOutput(appConnectionsSchema).build();
80811
81018
  var appPinsTrpc = defineTrpcContract("app").query("pins").withInput(channelPinsInputSchema).withOutput(channelAppPinsSchema).mutation("pin").withInput(pinAppInputSchema).withOutput(channelAppPinsSchema).mutation("unpin").withInput(pinAppInputSchema).withOutput(channelAppPinsSchema).mutation("setPinView").withInput(setPinViewInputSchema).withOutput(channelAppPinsSchema).mutation("reorderPins").withInput(reorderPinsInputSchema).withOutput(channelAppPinsSchema).mutation("setPinRole").withInput(setPinRoleInputSchema).withOutput(appAccessSchema).build();
80812
81019
  var appSettingsTrpc = defineTrpcContract("app").query("workspaceSettings").withInput(appWorkspaceRefSchema).withOutput(appWorkspaceSettingsSchema).query("functionSettings").withInput(appWorkspaceRefSchema).withOutput(appFunctionSettingsSchema).mutation("setFunctionsEnabled").withInput(setFunctionsEnabledInputSchema).withOutput(appFunctionSettingsSchema).mutation("setPublicAppsAllowed").withInput(setPublicAppsAllowedInputSchema).withOutput(appFunctionSettingsSchema).query("workspaceApps").withInput(listWorkspaceAppsInputSchema).withOutput(external_exports.array(workspaceAppSchema)).mutation("setOwner").withInput(setAppOwnerInputSchema).withOutput(workspaceAppSchema).mutation("unpublishAsAdmin").withInput(appRefSchema).withOutput(external_exports.object({ unpublished: external_exports.literal(true) })).query("templates").withInput(appWorkspaceRefSchema).withOutput(external_exports.array(appTemplateSchema)).mutation("upgradeTemplate").withInput(appRefSchema).withOutput(appTemplateUpgradeSchema).build();
@@ -85002,6 +85209,9 @@ async function browser({
85002
85209
  throw new CliUsageError(BROWSER_USAGE);
85003
85210
  }
85004
85211
 
85212
+ // src/services/channel-admin-commands.service.ts
85213
+ import { randomBytes as randomBytes4 } from "node:crypto";
85214
+
85005
85215
  // src/rules/channel-format.rules.ts
85006
85216
  function channelLabelOf(detail) {
85007
85217
  return detail.kind === "public" || detail.kind === "private" ? `#${detail.name}` : "(direct)";
@@ -85224,6 +85434,7 @@ async function channelCreate({
85224
85434
  const name3 = args.words[2];
85225
85435
  if (!name3) throw new CliUsageError(CREATE_USAGE2);
85226
85436
  const { client, profile } = await signedIn({ context, args });
85437
+ const clientKey = `ck_${randomBytes4(12).toString("hex")}`;
85227
85438
  return changing({
85228
85439
  context,
85229
85440
  profile,
@@ -85231,7 +85442,8 @@ async function channelCreate({
85231
85442
  const detail = await client.post("/api/agents/me/channels/create", {
85232
85443
  name: name3.replace(/^#/, ""),
85233
85444
  visibility: args.flags.private ? "private" : "public",
85234
- topic: flagText({ args, name: "topic" })
85445
+ topic: flagText({ args, name: "topic" }),
85446
+ clientKey
85235
85447
  });
85236
85448
  if (args.flags.json) return context.out(`${JSON.stringify(detail, null, 2)}
85237
85449
  `);
@@ -89972,8 +90184,11 @@ function conversationLineOf(chat) {
89972
90184
  const title = chat.title || "New chat";
89973
90185
  const names = chat.peopleNames.length > 0 ? chat.peopleNames : chat.people;
89974
90186
  const people2 = names.length > 0 ? ` with ${names.join(", ")}` : "";
89975
- const closed = chat.joined ? "" : " (closed)";
89976
- return `${chat.id} ${title}${people2}${closed}`;
90187
+ return `${chat.id} ${title}${people2}${stateOf2(chat)}`;
90188
+ }
90189
+ function stateOf2(chat) {
90190
+ if (chat.closedAt) return " (closed, whoever started it can reopen it)";
90191
+ return chat.joined ? "" : " (left)";
89977
90192
  }
89978
90193
 
89979
90194
  // src/services/conversation-commands.service.ts
@@ -89983,7 +90198,10 @@ var CONVERSATION_USAGE = `Usage:
89983
90198
  laze conversation list [--agent <agent>] yours (an agent: its own; --unnamed for untitled)
89984
90199
  laze conversation rename <id> <title> name it (its agent, or a person in it)
89985
90200
  laze conversation join <id> open one of an agent shared with you
89986
- laze conversation close <id> leave it; laze conversation join brings it back
90201
+ laze conversation close <id> close it for everyone (who started it, or an admin)
90202
+ laze conversation reopen <id> open a closed one again (who started it, or an admin)
90203
+ laze conversation convert <id> --name <n> turn it into a channel, history kept
90204
+ [--public] anyone in the workspace finds it (private otherwise)
89987
90205
  laze conversation leave <id> leave it and take it out of your lists
89988
90206
  laze conversation delete <id> delete it for everyone (who started it, or an admin)
89989
90207
  `;
@@ -90054,8 +90272,41 @@ async function conversationClose({ context, args }) {
90054
90272
  const channel = args.words[2];
90055
90273
  if (!channel) throw new CliUsageError(CONVERSATION_USAGE);
90056
90274
  const { client } = await signedIn({ context, args });
90057
- await client.post("/api/agents/me/channels/leave", { channel });
90058
- context.out(`Closed ${channel}. laze conversation join ${channel} opens it again.
90275
+ const closed = await client.post("/api/agents/me/conversations/close", {
90276
+ channel
90277
+ });
90278
+ if (args.flags.json) return context.out(`${JSON.stringify(closed, null, 2)}
90279
+ `);
90280
+ context.out(
90281
+ `Closed ${channel} for everyone. laze conversation reopen ${channel} opens it again.
90282
+ `
90283
+ );
90284
+ }
90285
+ async function conversationReopen({ context, args }) {
90286
+ const channel = args.words[2];
90287
+ if (!channel) throw new CliUsageError(CONVERSATION_USAGE);
90288
+ const { client } = await signedIn({ context, args });
90289
+ const reopened = await client.post("/api/agents/me/conversations/reopen", {
90290
+ channel
90291
+ });
90292
+ if (args.flags.json) return context.out(`${JSON.stringify(reopened, null, 2)}
90293
+ `);
90294
+ context.out(`Reopened ${conversationLineOf(reopened)}
90295
+ `);
90296
+ }
90297
+ async function conversationConvert({ context, args }) {
90298
+ const channel = args.words[2];
90299
+ const name3 = flagText({ args, name: "name" });
90300
+ if (!channel || !name3) throw new CliUsageError(CONVERSATION_USAGE);
90301
+ const { client } = await signedIn({ context, args });
90302
+ const visibility = args.flags.public ? "public" : "private";
90303
+ const converted = await client.post(
90304
+ "/api/agents/me/conversations/convert",
90305
+ { channel, name: name3, visibility }
90306
+ );
90307
+ if (args.flags.json) return context.out(`${JSON.stringify(converted, null, 2)}
90308
+ `);
90309
+ context.out(`Turned ${channel} into the ${visibility} channel #${name3}.
90059
90310
  `);
90060
90311
  }
90061
90312
  async function conversationLeave({ context, args }) {
@@ -92577,9 +92828,19 @@ var feedSharePersonSchema = feedSharePersonSchemaDefinition;
92577
92828
  var feedCommentReachSchemaDefinition = external_exports.object({
92578
92829
  hears: external_exports.boolean(),
92579
92830
  agentName: external_exports.string(),
92580
- ownerName: external_exports.string().nullable()
92831
+ ownerName: external_exports.string().nullable(),
92832
+ /** The reader's own personal agents the card can move to; empty when the agent hears them. */
92833
+ myAgents: external_exports.array(feedAgentSchema).default([])
92581
92834
  });
92582
92835
  var feedCommentReachSchema = feedCommentReachSchemaDefinition;
92836
+ var moveFeedItemToAgentInputSchemaDefinition = external_exports.object({
92837
+ workspaceId: external_exports.string().min(1),
92838
+ itemId: external_exports.string().min(1),
92839
+ agentId: external_exports.string().min(1),
92840
+ /** The mover's first comment on the new card; left out it asks the agent to take it over. */
92841
+ note: external_exports.string().trim().max(4e3).optional()
92842
+ });
92843
+ var moveFeedItemToAgentInputSchema = moveFeedItemToAgentInputSchemaDefinition;
92583
92844
  var feedShareAnswerSchemaDefinition = external_exports.object({
92584
92845
  itemIds: external_exports.array(external_exports.string()),
92585
92846
  people: external_exports.array(feedSharePersonSchemaDefinition),
@@ -92630,7 +92891,7 @@ var feedPageMirror = {
92630
92891
  },
92631
92892
  storable: feedPageForDisk
92632
92893
  };
92633
- var feedTrpc = defineTrpcContract("feed").query("channelItems").withInput(external_exports.object({ workspaceId: external_exports.string().min(1), channelId: external_exports.string().min(1) })).withOutput(external_exports.array(feedAgentItemSchema)).query("list").withInput(listFeedInputSchema).withOutput(feedViewSchema).query("page", { mirrored: feedPageMirror }).withInput(pageFeedInputSchema).withOutput(feedPageSchema).query("card").withInput(itemRef).withOutput(feedCardViewSchema).query("fileLink").withInput(feedFileLinkInputSchema).withOutput(feedFileLinkSchema).query("count").withInput(external_exports.object({ workspaceId: external_exports.string().min(1) })).withOutput(external_exports.object({ count: external_exports.number().int().nonnegative() })).query("decisions").withInput(external_exports.object({ workspaceId: external_exports.string().min(1) })).withOutput(feedDecisionsSchema).mutation("act").withInput(actFeedItemInputSchema).withOutput(feedItemSchema).mutation("comment").withInput(commentFeedItemInputSchema).withOutput(feedItemSchema).mutation("commentPlace").withInput(itemRef).withOutput(feedCommentPlaceSchema).query("commentDrafts").withInput(external_exports.object({ workspaceId: external_exports.string().min(1) })).withOutput(commentDraftListSchema).mutation("saveCommentDraft").withInput(saveCommentDraftInputSchema).withOutput(commentDraftSavedSchema).mutation("deleteCommentDraft").withInput(itemRef).withOutput(commentDraftSavedSchema).mutation("done").withInput(itemRef).withOutput(feedItemSchema).mutation("stopAutoSend").withInput(itemRef).withOutput(feedItemSchema).mutation("putBack").withInput(putBackFeedItemInputSchema).withOutput(feedItemSchema).mutation("snooze").withInput(snoozeFeedItemInputSchema).withOutput(feedItemSchema).mutation("unsnooze").withInput(itemRef).withOutput(feedItemSchema).mutation("saveDraft").withInput(saveFeedDraftInputSchema).withOutput(feedItemSchema).mutation("editItem").withInput(editFeedItemInputSchema).withOutput(feedItemSchema).mutation("saveMessage").withInput(saveFeedMessageInputSchema).withOutput(feedItemSchema).mutation("share").withInput(shareFeedItemInputSchema).withOutput(feedShareAnswerSchema).mutation("unshare").withInput(unshareFeedItemInputSchema).withOutput(feedShareAnswerSchema).query("shareCandidates").withInput(itemRef).withOutput(external_exports.array(feedSharePersonSchema)).query("commentReach").withInput(itemRef).withOutput(feedCommentReachSchema).mutation("answerApproval").withInput(answerFeedApprovalInputSchema).withOutput(feedItemSchema).mutation("decidePublish").withInput(decideFeedPublishInputSchema).withOutput(feedItemSchema).mutation("decideAccess").withInput(decideFeedRequestInputSchema).withOutput(feedItemSchema).mutation("decideServer").withInput(decideFeedRequestInputSchema).withOutput(feedItemSchema).mutation("decideAppAccess").withInput(decideFeedRequestInputSchema).withOutput(feedItemSchema).mutation("decideComputer").withInput(decideFeedRequestInputSchema).withOutput(feedItemSchema).mutation("decideAgentJoin").withInput(decideFeedRequestInputSchema).withOutput(feedItemSchema).mutation("decideAgentTransfer").withInput(decideFeedRequestInputSchema).withOutput(feedItemSchema).mutation("pin").withInput(pinFeedItemInputSchema).withOutput(feedItemSchema).mutation("markRead").withInput(itemRef).withOutput(feedItemSchema).mutation("markUnread").withInput(itemRef).withOutput(feedItemSchema).mutation("markAllRead").withInput(external_exports.object({ workspaceId: external_exports.string().min(1) })).withOutput(external_exports.object({ workspaceId: external_exports.string() })).query("delegates").withInput(external_exports.object({ workspaceId: external_exports.string().min(1) })).withOutput(external_exports.array(feedDelegateSchema)).mutation("setDelegate").withInput(setFeedDelegateInputSchema).withOutput(external_exports.array(feedDelegateSchema)).build();
92894
+ var feedTrpc = defineTrpcContract("feed").query("channelItems").withInput(external_exports.object({ workspaceId: external_exports.string().min(1), channelId: external_exports.string().min(1) })).withOutput(external_exports.array(feedAgentItemSchema)).query("list").withInput(listFeedInputSchema).withOutput(feedViewSchema).query("page", { mirrored: feedPageMirror }).withInput(pageFeedInputSchema).withOutput(feedPageSchema).query("card").withInput(itemRef).withOutput(feedCardViewSchema).query("fileLink").withInput(feedFileLinkInputSchema).withOutput(feedFileLinkSchema).query("count").withInput(external_exports.object({ workspaceId: external_exports.string().min(1) })).withOutput(external_exports.object({ count: external_exports.number().int().nonnegative() })).query("decisions").withInput(external_exports.object({ workspaceId: external_exports.string().min(1) })).withOutput(feedDecisionsSchema).mutation("act").withInput(actFeedItemInputSchema).withOutput(feedItemSchema).mutation("comment").withInput(commentFeedItemInputSchema).withOutput(feedItemSchema).mutation("commentPlace").withInput(itemRef).withOutput(feedCommentPlaceSchema).query("commentDrafts").withInput(external_exports.object({ workspaceId: external_exports.string().min(1) })).withOutput(commentDraftListSchema).mutation("saveCommentDraft").withInput(saveCommentDraftInputSchema).withOutput(commentDraftSavedSchema).mutation("deleteCommentDraft").withInput(itemRef).withOutput(commentDraftSavedSchema).mutation("done").withInput(itemRef).withOutput(feedItemSchema).mutation("stopAutoSend").withInput(itemRef).withOutput(feedItemSchema).mutation("putBack").withInput(putBackFeedItemInputSchema).withOutput(feedItemSchema).mutation("snooze").withInput(snoozeFeedItemInputSchema).withOutput(feedItemSchema).mutation("unsnooze").withInput(itemRef).withOutput(feedItemSchema).mutation("saveDraft").withInput(saveFeedDraftInputSchema).withOutput(feedItemSchema).mutation("editItem").withInput(editFeedItemInputSchema).withOutput(feedItemSchema).mutation("saveMessage").withInput(saveFeedMessageInputSchema).withOutput(feedItemSchema).mutation("share").withInput(shareFeedItemInputSchema).withOutput(feedShareAnswerSchema).mutation("unshare").withInput(unshareFeedItemInputSchema).withOutput(feedShareAnswerSchema).query("shareCandidates").withInput(itemRef).withOutput(external_exports.array(feedSharePersonSchema)).query("commentReach").withInput(itemRef).withOutput(feedCommentReachSchema).mutation("moveToAgent").withInput(moveFeedItemToAgentInputSchema).withOutput(feedItemSchema).mutation("answerApproval").withInput(answerFeedApprovalInputSchema).withOutput(feedItemSchema).mutation("decidePublish").withInput(decideFeedPublishInputSchema).withOutput(feedItemSchema).mutation("decideAccess").withInput(decideFeedRequestInputSchema).withOutput(feedItemSchema).mutation("decideServer").withInput(decideFeedRequestInputSchema).withOutput(feedItemSchema).mutation("decideAppAccess").withInput(decideFeedRequestInputSchema).withOutput(feedItemSchema).mutation("decideComputer").withInput(decideFeedRequestInputSchema).withOutput(feedItemSchema).mutation("decideAgentJoin").withInput(decideFeedRequestInputSchema).withOutput(feedItemSchema).mutation("decideAgentTransfer").withInput(decideFeedRequestInputSchema).withOutput(feedItemSchema).mutation("pin").withInput(pinFeedItemInputSchema).withOutput(feedItemSchema).mutation("markRead").withInput(itemRef).withOutput(feedItemSchema).mutation("markUnread").withInput(itemRef).withOutput(feedItemSchema).mutation("markAllRead").withInput(external_exports.object({ workspaceId: external_exports.string().min(1) })).withOutput(external_exports.object({ workspaceId: external_exports.string() })).query("delegates").withInput(external_exports.object({ workspaceId: external_exports.string().min(1) })).withOutput(external_exports.array(feedDelegateSchema)).mutation("setDelegate").withInput(setFeedDelegateInputSchema).withOutput(external_exports.array(feedDelegateSchema)).build();
92634
92895
  var feedUi = uiTokens("feed");
92635
92896
  var FeedNavSlot = feedUi.component("nav");
92636
92897
  var FeedDecisionsSlot = feedUi.component("decisions");
@@ -96269,7 +96530,7 @@ async function openclaw({
96269
96530
  }
96270
96531
 
96271
96532
  // src/services/operator-key-commands.service.ts
96272
- import { createHash as createHash7, randomBytes as randomBytes4 } from "node:crypto";
96533
+ import { createHash as createHash7, randomBytes as randomBytes5 } from "node:crypto";
96273
96534
  import { mkdir as mkdir11, readFile as readFile31, rm as rm18, writeFile as writeFile9 } from "node:fs/promises";
96274
96535
  import { dirname as dirname22, join as join31 } from "node:path";
96275
96536
 
@@ -96884,6 +97145,7 @@ var ChatDisplaySettingsSlot = workspaceUi.extension("settings.chatDisplay");
96884
97145
  var CliKeysSettingsSlot = workspaceUi.extension("settings.cliKeys");
96885
97146
  var SignInSettingsSlot = workspaceUi.extension("settings.signIn");
96886
97147
  var AppsSettingsSlot = workspaceUi.extension("settings.apps");
97148
+ var ConversationSettingsSlot = workspaceUi.extension("settings.conversations");
96887
97149
  var BillingSettingsSlot = workspaceUi.extension("settings.billing");
96888
97150
  var ModelSettingsSlot = workspaceUi.extension("settings.models");
96889
97151
  var AgentLoginsSettingsSlot = workspaceUi.extension("settings.agentLogins");
@@ -97701,7 +97963,7 @@ async function requestKey({ context, args }) {
97701
97963
  const reason2 = flagText({ args, name: "reason" });
97702
97964
  if (!action || !target || !reason2.trim()) throw new CliUsageError(OPERATOR_KEY_USAGE);
97703
97965
  const { client } = await signedIn({ context, args });
97704
- const secret = randomBytes4(32).toString("hex");
97966
+ const secret = randomBytes5(32).toString("hex");
97705
97967
  const key = await client.post(OPERATOR_KEY_REST_PATHS.request, {
97706
97968
  action,
97707
97969
  target,
@@ -98666,13 +98928,13 @@ var SCIM_USAGE = `Usage:
98666
98928
  laze scim revoke-token <id> the directory is refused at once`;
98667
98929
  var printJson10 = (context, data) => context.out(`${JSON.stringify(data, null, 2)}
98668
98930
  `);
98669
- function stateOf2(claim3) {
98931
+ function stateOf3(claim3) {
98670
98932
  if (!claim3.verified) return "not verified";
98671
98933
  if (!claim3.connected) return "verified";
98672
98934
  return `connected (${claim3.provider === "google" ? "Google Workspace" : "OIDC"})`;
98673
98935
  }
98674
98936
  function printClaim(context, claim3) {
98675
- const state = stateOf2(claim3);
98937
+ const state = stateOf3(claim3);
98676
98938
  context.out(`${claim3.domain} ${state}${claim3.enforced ? " enforced" : ""}
98677
98939
  `);
98678
98940
  if (!claim3.verified) {
@@ -101112,6 +101374,8 @@ var COMMANDS4 = {
101112
101374
  "conversation rename": conversationRename,
101113
101375
  "conversation join": conversationJoin,
101114
101376
  "conversation close": conversationClose,
101377
+ "conversation reopen": conversationReopen,
101378
+ "conversation convert": conversationConvert,
101115
101379
  "conversation leave": conversationLeave,
101116
101380
  "conversation delete": conversationDelete,
101117
101381
  conversation: conversationUsage,
@@ -101303,10 +101567,19 @@ async function runCli({
101303
101567
  const quiet = args.words[0] === "hook";
101304
101568
  return await command({ context: watchingRelease({ context, quiet }), args }) ?? 0;
101305
101569
  } catch (error63) {
101306
- return exitCodeOf({ context, error: error63 });
101570
+ return exitCodeOf({ context, error: error63, hook: args.words[0] === "hook" });
101307
101571
  }
101308
101572
  }
101309
- function exitCodeOf({ context, error: error63 }) {
101573
+ function exitCodeOf({
101574
+ context,
101575
+ error: error63,
101576
+ hook
101577
+ }) {
101578
+ if (error63 instanceof ProfileRefusedError) {
101579
+ context.err(`${revokedKeyLineOf({ profile: error63.profile })}
101580
+ `);
101581
+ return hook ? 0 : 1;
101582
+ }
101310
101583
  if (error63 instanceof ProfileMigratedError) return 0;
101311
101584
  const migrated = migratedNoticeOf(error63);
101312
101585
  if (migrated) context.err(`${migrated.notice}
@@ -101329,7 +101602,7 @@ import {
101329
101602
  createHash as createHash8,
101330
101603
  createPrivateKey,
101331
101604
  generateKeyPairSync,
101332
- randomBytes as randomBytes5,
101605
+ randomBytes as randomBytes6,
101333
101606
  sign
101334
101607
  } from "node:crypto";
101335
101608
  import { chmod, link, mkdir as mkdir12, readFile as readFile37, rm as rm21, writeFile as writeFile11 } from "node:fs/promises";
@@ -101491,7 +101764,7 @@ function keyOf2({ meta: meta3, privateKey }) {
101491
101764
  }
101492
101765
  var shortOf = (jwk) => thumbprintOf({ jwk }).slice(0, 12);
101493
101766
  async function writeOnce({ path, text: text3 }) {
101494
- const temporary = `${path}.${process.pid}.${randomBytes5(6).toString("hex")}.tmp`;
101767
+ const temporary = `${path}.${process.pid}.${randomBytes6(6).toString("hex")}.tmp`;
101495
101768
  await writePrivate({ path: temporary, text: text3 });
101496
101769
  try {
101497
101770
  await link(temporary, path);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lazehq/cli",
3
- "version": "0.1.97",
3
+ "version": "0.1.99",
4
4
  "description": "The Laze command line: sign in, read and post in chat, and connect your own Claude Code or Codex session as an agent.",
5
5
  "license": "UNLICENSED",
6
6
  "type": "module",