@notis_ai/cli 0.2.27 → 0.2.29

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 (53) hide show
  1. package/README.md +2 -2
  2. package/config/notis_app_design_rules.json +5 -123
  3. package/dist/agent-hooks/notis-agent-hook.mjs +453 -109
  4. package/dist/base-skills/notis-spaces/.notis-base-skill.json +1 -1
  5. package/dist/base-skills/notis-spaces/SKILL.md +13 -19
  6. package/dist/base-skills/notis-spaces/references/design.md +11 -45
  7. package/dist/base-skills/notis-spaces/references/sdk.md +94 -68
  8. package/dist/base-skills/notis-spaces/references/views.md +12 -1
  9. package/dist/sdk/src/components/NotisCommentBoundary.tsx +43 -83
  10. package/dist/sdk/src/components/NotisSelectionBoundary.tsx +28 -8
  11. package/dist/sdk/src/components/SelectionActionBar.tsx +383 -0
  12. package/dist/sdk/src/components/selectionId.ts +6 -0
  13. package/dist/sdk/src/hooks/useCollectionInteractions.ts +5 -2
  14. package/dist/sdk/src/runtime.ts +5 -0
  15. package/dist/sdk/src/space.ts +4 -0
  16. package/dist/sdk/src/ui/icons.tsx +11 -2
  17. package/dist/sdk/src/words/actions.ts +9 -1
  18. package/dist/sdk/src/words/keymap.ts +3 -0
  19. package/dist/space-harness/host.js +181 -141
  20. package/dist/space-sdk/dist/{chunk-BWHAORT4.js → chunk-BFGB6XXC.js} +2 -2
  21. package/dist/space-sdk/dist/index.js +2 -2
  22. package/dist/space-sdk/dist/ui.js +14 -11
  23. package/dist/space-sdk/src/components/NotisCommentBoundary.d.ts +0 -10
  24. package/dist/space-sdk/src/components/NotisSelectionBoundary.d.ts +7 -0
  25. package/dist/space-sdk/src/runtime.d.ts +5 -0
  26. package/dist/space-sdk/src/space.ts +4 -0
  27. package/dist/space-sdk/src/tailwind-candidates.d.ts +126 -17
  28. package/dist/space-sdk/src/ui/blocks/DataTable.d.ts +86 -0
  29. package/dist/space-sdk/src/ui/blocks/InfoTip.d.ts +25 -0
  30. package/dist/space-sdk/src/ui/blocks/Meter.d.ts +39 -0
  31. package/dist/space-sdk/src/ui/blocks/blocks.d.ts +1 -1
  32. package/dist/space-sdk/src/ui/blocks/index.d.ts +6 -0
  33. package/dist/space-sdk/src/ui/charts/Chart.d.ts +15 -2
  34. package/dist/space-sdk/src/ui/charts/StatRow.d.ts +4 -3
  35. package/dist/space-sdk/src/ui/charts/chartData.d.ts +6 -0
  36. package/dist/space-sdk/src/ui/comments/useComments.d.ts +19 -1
  37. package/dist/space-sdk/src/ui/icons.d.ts +1 -1
  38. package/dist/space-sdk/src/ui/index.d.ts +2 -2
  39. package/dist/space-sdk/src/ui/list/Row.d.ts +10 -3
  40. package/dist/space-sdk/src/ui/period/dateFormat.d.ts +14 -0
  41. package/dist/space-sdk/src/words/actions.ts +9 -1
  42. package/dist/space-sdk/src/words/keymap.ts +3 -0
  43. package/dist/view-renderer/dist/host.js +253 -213
  44. package/dist/view-renderer/src/renderer.js +38 -2
  45. package/package.json +3 -3
  46. package/src/command-specs/computer.js +3 -3
  47. package/src/command-specs/spaces.js +28 -8
  48. package/src/command-specs/tools.js +1 -1
  49. package/src/runtime/app-platform.js +74 -11
  50. package/src/runtime/space-fixture-broker.js +23 -2
  51. package/src/runtime/space-verification.js +62 -10
  52. package/template/components/ui/button.tsx +1 -1
  53. package/template/components/ui/native-select.tsx +1 -1
@@ -14114,9 +14114,10 @@ var require_lib = __commonJS({
14114
14114
  EscapedCharNotAnIdentifier: "Invalid Unicode escape.",
14115
14115
  ExportBindingIsString: ({
14116
14116
  localName,
14117
- exportName
14117
+ exportName,
14118
+ typeModifierIn
14118
14119
  }) => `A string literal cannot be used as an exported binding without \`from\`.
14119
- - Did you mean \`export { '${localName}' as '${exportName}' } from 'some-module'\`?`,
14120
+ - Did you mean \`export ${typeModifierIn === "declaration" ? "type " : ""}{ ${typeModifierIn === "specifier" ? "type " : ""}'${localName}' as '${exportName}' } from 'some-module'\`?`,
14120
14121
  ExportDefaultFromAsIdentifier: "'from' is not allowed as an identifier after 'export default'.",
14121
14122
  ForInOfLoopInitializer: ({
14122
14123
  type
@@ -16989,7 +16990,6 @@ var require_lib = __commonJS({
16989
16990
  }
16990
16991
  this.expect(17);
16991
16992
  const state = this.state.clone();
16992
- const originalNoArrowAt = this.state.noArrowAt;
16993
16993
  const node = this.startNodeAt(startLoc);
16994
16994
  let {
16995
16995
  consequent,
@@ -16997,12 +16997,10 @@ var require_lib = __commonJS({
16997
16997
  } = this.tryParseConditionalConsequent();
16998
16998
  let [valid, invalid] = this.getArrowLikeExpressions(consequent);
16999
16999
  if (failed || invalid.length > 0) {
17000
- const noArrowAt = [...originalNoArrowAt];
17001
17000
  if (invalid.length > 0) {
17002
17001
  this.state = state;
17003
- this.state.noArrowAt = noArrowAt;
17004
17002
  for (let i = 0; i < invalid.length; i++) {
17005
- noArrowAt.push(invalid[i].start);
17003
+ this.noArrowAt.add(this.offsetToSourcePos(invalid[i].start));
17006
17004
  }
17007
17005
  ({
17008
17006
  consequent,
@@ -17015,8 +17013,7 @@ var require_lib = __commonJS({
17015
17013
  }
17016
17014
  if (failed && valid.length === 1) {
17017
17015
  this.state = state;
17018
- noArrowAt.push(valid[0].start);
17019
- this.state.noArrowAt = noArrowAt;
17016
+ this.noArrowAt.add(this.offsetToSourcePos(valid[0].start));
17020
17017
  ({
17021
17018
  consequent,
17022
17019
  failed
@@ -17024,7 +17021,6 @@ var require_lib = __commonJS({
17024
17021
  }
17025
17022
  }
17026
17023
  this.getArrowLikeExpressions(consequent, true);
17027
- this.state.noArrowAt = originalNoArrowAt;
17028
17024
  this.expect(14);
17029
17025
  node.test = expr;
17030
17026
  node.consequent = consequent;
@@ -17501,8 +17497,8 @@ var require_lib = __commonJS({
17501
17497
  }
17502
17498
  return super.parseAsyncArrowFromCallExpression(node, call);
17503
17499
  }
17504
- shouldParseAsyncArrow() {
17505
- return this.match(14) || super.shouldParseAsyncArrow();
17500
+ parseAsyncArrowHead(startLoc) {
17501
+ return this.match(14) ? this.startNodeAt(startLoc) : super.parseAsyncArrowHead(startLoc);
17506
17502
  }
17507
17503
  parseMaybeAssign(refExpressionErrors, afterLeftParse) {
17508
17504
  var _jsx;
@@ -17603,10 +17599,10 @@ var require_lib = __commonJS({
17603
17599
  super.checkParams(node, allowDuplicates, isArrowFunction, strictModeChanged);
17604
17600
  }
17605
17601
  parseParenAndDistinguishExpression(canBeArrow) {
17606
- return super.parseParenAndDistinguishExpression(canBeArrow && !this.state.noArrowAt.includes(this.sourceToOffsetPos(this.state.start)));
17602
+ return super.parseParenAndDistinguishExpression(canBeArrow && !this.noArrowAt.has(this.state.start));
17607
17603
  }
17608
17604
  parseSubscripts(base, startLoc, noCalls) {
17609
- if (base.type === "Identifier" && base.name === "async" && this.state.noArrowAt.includes(startLoc.index)) {
17605
+ if (base.type === "Identifier" && base.name === "async" && this.noArrowAt.has(this.offsetToSourcePos(startLoc.index))) {
17610
17606
  this.next();
17611
17607
  const node = this.startNodeAt(startLoc);
17612
17608
  node.callee = base;
@@ -18945,6 +18941,7 @@ var require_lib = __commonJS({
18945
18941
  constructor() {
18946
18942
  this.sawUnambiguousESM = false;
18947
18943
  this.ambiguousScriptDifferentAst = false;
18944
+ this.noArrowAt = /* @__PURE__ */ new Set();
18948
18945
  }
18949
18946
  sourceToOffsetPos(sourcePos) {
18950
18947
  return sourcePos + this.startIndex;
@@ -19166,7 +19163,7 @@ var require_lib = __commonJS({
19166
19163
  };
19167
19164
  var State = class _State {
19168
19165
  constructor() {
19169
- this.flags = 1024;
19166
+ this.flags = 512;
19170
19167
  this.startIndex = void 0;
19171
19168
  this.curLine = void 0;
19172
19169
  this.lineStart = void 0;
@@ -19174,8 +19171,8 @@ var require_lib = __commonJS({
19174
19171
  this.endLoc = void 0;
19175
19172
  this.errors = [];
19176
19173
  this.potentialArrowAt = -1;
19177
- this.noArrowAt = [];
19178
19174
  this.noArrowParamsConversionAt = [];
19175
+ this.tsArrowReturnTypeRestrictionAt = -1;
19179
19176
  this.regExpAllowedAt = -1;
19180
19177
  this.topicContext = {
19181
19178
  maxNumOfResolvableTopics: 0,
@@ -19265,41 +19262,48 @@ var require_lib = __commonJS({
19265
19262
  if (v) this.flags |= 128;
19266
19263
  else this.flags &= -129;
19267
19264
  }
19268
- get inConditionalConsequent() {
19265
+ get soloAwait() {
19269
19266
  return (this.flags & 256) > 0;
19270
19267
  }
19271
- set inConditionalConsequent(v) {
19268
+ set soloAwait(v) {
19272
19269
  if (v) this.flags |= 256;
19273
19270
  else this.flags &= -257;
19274
19271
  }
19275
- get soloAwait() {
19272
+ get canStartJSXElement() {
19276
19273
  return (this.flags & 512) > 0;
19277
19274
  }
19278
- set soloAwait(v) {
19275
+ set canStartJSXElement(v) {
19279
19276
  if (v) this.flags |= 512;
19280
19277
  else this.flags &= -513;
19281
19278
  }
19282
- get canStartJSXElement() {
19279
+ get containsEsc() {
19283
19280
  return (this.flags & 1024) > 0;
19284
19281
  }
19285
- set canStartJSXElement(v) {
19282
+ set containsEsc(v) {
19286
19283
  if (v) this.flags |= 1024;
19287
19284
  else this.flags &= -1025;
19288
19285
  }
19289
- get containsEsc() {
19286
+ get hasTopLevelAwait() {
19290
19287
  return (this.flags & 2048) > 0;
19291
19288
  }
19292
- set containsEsc(v) {
19289
+ set hasTopLevelAwait(v) {
19293
19290
  if (v) this.flags |= 2048;
19294
19291
  else this.flags &= -2049;
19295
19292
  }
19296
- get hasTopLevelAwait() {
19293
+ get tsArrowReturnTypeAllowed() {
19297
19294
  return (this.flags & 4096) > 0;
19298
19295
  }
19299
- set hasTopLevelAwait(v) {
19296
+ set tsArrowReturnTypeAllowed(v) {
19300
19297
  if (v) this.flags |= 4096;
19301
19298
  else this.flags &= -4097;
19302
19299
  }
19300
+ get tsGenericArrowParams() {
19301
+ return (this.flags & 8192) > 0;
19302
+ }
19303
+ set tsGenericArrowParams(v) {
19304
+ if (v) this.flags |= 8192;
19305
+ else this.flags &= -8193;
19306
+ }
19303
19307
  curPosition() {
19304
19308
  return new Position(this.curLine, this.pos - this.lineStart, this.pos + this.startIndex);
19305
19309
  }
@@ -19313,8 +19317,8 @@ var require_lib = __commonJS({
19313
19317
  state.endLoc = this.endLoc;
19314
19318
  state.errors = this.errors.slice();
19315
19319
  state.potentialArrowAt = this.potentialArrowAt;
19316
- state.noArrowAt = this.noArrowAt.slice();
19317
19320
  state.noArrowParamsConversionAt = this.noArrowParamsConversionAt.slice();
19321
+ state.tsArrowReturnTypeRestrictionAt = this.tsArrowReturnTypeRestrictionAt;
19318
19322
  state.topicContext = this.topicContext;
19319
19323
  state.regExpAllowedAt = this.regExpAllowedAt;
19320
19324
  state.labels = this.labels.slice();
@@ -19599,12 +19603,11 @@ var require_lib = __commonJS({
19599
19603
  if (code2 !== null && code2 > 1114111) {
19600
19604
  if (throwOnInvalid) {
19601
19605
  errors.invalidCodePoint(pos, lineStart, curLine);
19602
- } else {
19603
- return {
19604
- code: null,
19605
- pos
19606
- };
19607
19606
  }
19607
+ return {
19608
+ code: null,
19609
+ pos
19610
+ };
19608
19611
  }
19609
19612
  } else {
19610
19613
  ({
@@ -22165,20 +22168,26 @@ var require_lib = __commonJS({
22165
22168
  } else {
22166
22169
  node.arguments = this.parseCallExpressionArguments(base.type !== "Super", node, refExpressionErrors);
22167
22170
  }
22168
- let finishedNode = this.finishCallExpression(node, optionalChainMember);
22169
- if (maybeAsyncArrow && this.shouldParseAsyncArrow() && !optional) {
22170
- state.stop = true;
22171
- this.checkDestructuringPrivate(refExpressionErrors);
22172
- this.expressionScope.validateAsPattern();
22173
- this.expressionScope.exit();
22174
- finishedNode = this.parseAsyncArrowFromCallExpression(this.startNodeAt(startLoc), finishedNode);
22175
- } else {
22176
- if (maybeAsyncArrow) {
22177
- this.checkExpressionErrors(refExpressionErrors, true);
22171
+ const finishedNode = this.finishCallExpression(node, optionalChainMember);
22172
+ if (maybeAsyncArrow && !optional) {
22173
+ const errorsLength = this.state.errors.length;
22174
+ const asyncArrowHead = this.parseAsyncArrowHead(startLoc);
22175
+ if (asyncArrowHead) {
22176
+ const returnTypeErrors = this.state.errors.length > errorsLength ? this.state.errors.splice(errorsLength) : void 0;
22177
+ state.stop = true;
22178
+ this.checkDestructuringPrivate(refExpressionErrors);
22179
+ this.expressionScope.validateAsPattern();
22178
22180
  this.expressionScope.exit();
22181
+ if (returnTypeErrors) this.state.errors.push(...returnTypeErrors);
22182
+ this.state.maybeInArrowParameters = oldMaybeInArrowParameters;
22183
+ return this.parseAsyncArrowFromCallExpression(asyncArrowHead, finishedNode);
22179
22184
  }
22180
- this.toReferencedArguments(finishedNode);
22181
22185
  }
22186
+ if (maybeAsyncArrow) {
22187
+ this.checkExpressionErrors(refExpressionErrors, true);
22188
+ this.expressionScope.exit();
22189
+ }
22190
+ this.toReferencedArguments(finishedNode);
22182
22191
  this.state.maybeInArrowParameters = oldMaybeInArrowParameters;
22183
22192
  return finishedNode;
22184
22193
  }
@@ -22231,8 +22240,8 @@ var require_lib = __commonJS({
22231
22240
  }
22232
22241
  return elts;
22233
22242
  }
22234
- shouldParseAsyncArrow() {
22235
- return this.match(19) && !this.canInsertSemicolon();
22243
+ parseAsyncArrowHead(startLoc) {
22244
+ return this.match(19) && !this.canInsertSemicolon() ? this.startNodeAt(startLoc) : void 0;
22236
22245
  }
22237
22246
  parseAsyncArrowFromCallExpression(node, call) {
22238
22247
  var _call$extra;
@@ -22488,9 +22497,11 @@ var require_lib = __commonJS({
22488
22497
  const oldLabels = this.state.labels;
22489
22498
  this.state.labels = [];
22490
22499
  if (isAsync) {
22500
+ this.expressionScope.enter(sharedExpressionScope);
22491
22501
  this.prodParam.enter(2);
22492
22502
  node.body = this.parseBlock();
22493
22503
  this.prodParam.exit();
22504
+ this.expressionScope.exit();
22494
22505
  } else {
22495
22506
  node.body = this.parseBlock();
22496
22507
  }
@@ -22552,7 +22563,7 @@ var require_lib = __commonJS({
22552
22563
  parseImportMetaPropertyOrPhaseCall(node) {
22553
22564
  this.next();
22554
22565
  if (this.isContextual(106) || this.isContextual(98)) {
22555
- const isSource = this.isContextual(106);
22566
+ const isSource = this.match(106);
22556
22567
  this.expectPlugin(isSource ? "sourcePhaseImports" : "deferredImportEvaluation");
22557
22568
  this.next();
22558
22569
  node.phase = isSource ? "source" : "defer";
@@ -23287,7 +23298,7 @@ var require_lib = __commonJS({
23287
23298
  return this.finishNode(node, "YieldExpression");
23288
23299
  }
23289
23300
  parseImportCall(node) {
23290
- this.next();
23301
+ this.expect(10);
23291
23302
  node.source = this.parseMaybeAssignAllowIn();
23292
23303
  node.options = null;
23293
23304
  if (this.eat(12)) {
@@ -24476,7 +24487,7 @@ var require_lib = __commonJS({
24476
24487
  return this.finishNode(node, isStatement ? "ClassDeclaration" : "ClassExpression");
24477
24488
  }
24478
24489
  isClassProperty() {
24479
- return this.match(29) || this.match(13) || this.match(8);
24490
+ return this.match(29) || this.match(13) || this.match(8) || this.match(26) && this.hasPrecedingLineBreak();
24480
24491
  }
24481
24492
  isClassMethod() {
24482
24493
  return this.match(10);
@@ -25026,7 +25037,8 @@ var require_lib = __commonJS({
25026
25037
  if (local.type !== "Identifier") {
25027
25038
  this.raise(Errors.ExportBindingIsString, specifier, {
25028
25039
  localName: local.value,
25029
- exportName
25040
+ exportName,
25041
+ typeModifierIn: node.exportKind === "type" ? "declaration" : specifier.exportKind === "type" ? "specifier" : void 0
25030
25042
  });
25031
25043
  } else {
25032
25044
  this.checkReservedWord(local.name, local.loc.start, true, false);
@@ -25579,6 +25591,40 @@ var require_lib = __commonJS({
25579
25591
  return false;
25580
25592
  }
25581
25593
  }
25594
+ function tsIsInvalidArrowParamsError(error, returnTypeStart) {
25595
+ if (error.pos >= returnTypeStart) return false;
25596
+ switch (error.reasonCode) {
25597
+ case "AwaitBindingIdentifier":
25598
+ case "AwaitExpressionFormalParameter":
25599
+ case "IllegalLanguageModeDirective":
25600
+ case "ParamDupe":
25601
+ case "StrictEvalArgumentsBinding":
25602
+ case "VarRedeclaration":
25603
+ case "YieldInParameter":
25604
+ return false;
25605
+ default:
25606
+ return true;
25607
+ }
25608
+ }
25609
+ function tsHasUnambiguousArrowParams(params) {
25610
+ var _first, _first2, _first3;
25611
+ if (!(params != null && params.length)) return true;
25612
+ let first = params[0];
25613
+ if (((_first = first) == null ? void 0 : _first.type) === "AssignmentPattern" || ((_first2 = first) == null ? void 0 : _first2.type) === "AssignmentExpression") {
25614
+ first = first.left;
25615
+ }
25616
+ switch ((_first3 = first) == null ? void 0 : _first3.type) {
25617
+ case "RestElement":
25618
+ case "SpreadElement":
25619
+ return true;
25620
+ case "TSTypeCastExpression":
25621
+ return first.expression.type === "Identifier" || first.expression.type === "ThisExpression";
25622
+ case "Identifier":
25623
+ return !!first.typeAnnotation || !!first.optional;
25624
+ default:
25625
+ return false;
25626
+ }
25627
+ }
25582
25628
  var typescript = (superClass) => class TypeScriptParserMixin extends superClass {
25583
25629
  constructor(...args) {
25584
25630
  super(...args);
@@ -25597,6 +25643,7 @@ var require_lib = __commonJS({
25597
25643
  disallowedModifiers: ["public", "private", "protected", "readonly", "declare", "abstract", "override"],
25598
25644
  errorTemplate: TSErrors.InvalidModifierOnTypeParameter
25599
25645
  });
25646
+ this.tsArrowReturnTypeAt = /* @__PURE__ */ new Map();
25600
25647
  }
25601
25648
  getScopeHandler() {
25602
25649
  return TypeScriptScopeHandler;
@@ -26920,12 +26967,18 @@ var require_lib = __commonJS({
26920
26967
  node.typeParameters = this.tsParseTypeParameters(this.tsParseConstModifier);
26921
26968
  super.parseFunctionParams(node);
26922
26969
  node.returnType = this.tsTryParseTypeOrTypePredicateAnnotation();
26970
+ const arrowStartPos = this.offsetToSourcePos(startLoc.index);
26971
+ if (node.returnType && this.match(19) && this.tsIsArrowReturnTypeRestrictedAt(arrowStartPos)) {
26972
+ this.tsArrowReturnTypeAt.set(arrowStartPos, node.returnType.start);
26973
+ }
26923
26974
  this.expect(19);
26924
26975
  return node;
26925
26976
  });
26926
26977
  this.state.maybeInArrowParameters = oldMaybeInArrowParameters;
26927
26978
  if (!res) return;
26928
- return super.parseArrowExpression(res, null, true);
26979
+ const startPos = this.offsetToSourcePos(startLoc.index);
26980
+ const parse4 = () => res.returnType && this.tsIsArrowReturnTypeRestrictedAt(startPos) ? this.tsParseWithDeferredArrowErrors(() => super.parseArrowExpression(res, null, true)) : super.parseArrowExpression(res, null, true);
26981
+ return this.tsIsArrowReturnTypeRestrictedAt(startPos) ? this.tsParseWithRestrictedArrowReturnType(parse4, this.hasPlugin("jsx") || this.state.tsArrowReturnTypeAllowed) : parse4();
26929
26982
  }
26930
26983
  tsParseTypeArgumentsInExpression() {
26931
26984
  if (this.reScan_lt() !== 47) return;
@@ -27063,7 +27116,8 @@ var require_lib = __commonJS({
27063
27116
  }
27064
27117
  if (this.match(47) || this.match(51)) {
27065
27118
  let missingParenErrorLoc;
27066
- const result = this.tsTryParseAndCatch(() => {
27119
+ let parsingAsyncArrow = true;
27120
+ const parseAttempt = () => {
27067
27121
  if (!noCalls && this.atPossibleAsyncArrow(base)) {
27068
27122
  const asyncArrowFn = this.tsTryParseGenericAsyncArrowFunction(startLoc);
27069
27123
  if (asyncArrowFn) {
@@ -27071,6 +27125,7 @@ var require_lib = __commonJS({
27071
27125
  return asyncArrowFn;
27072
27126
  }
27073
27127
  }
27128
+ parsingAsyncArrow = false;
27074
27129
  const typeArguments = this.tsParseTypeArgumentsInExpression();
27075
27130
  if (!typeArguments) return;
27076
27131
  if (isOptionalCall && !this.match(10)) {
@@ -27101,7 +27156,13 @@ var require_lib = __commonJS({
27101
27156
  node.expression = base;
27102
27157
  node.typeParameters = typeArguments;
27103
27158
  return this.finishNode(node, "TSInstantiationExpression");
27104
- });
27159
+ };
27160
+ const attempt = this.tryParse((abort) => parseAttempt() || abort());
27161
+ if (attempt.thrown && parsingAsyncArrow && this.tsShouldKeepArrowErrorAt(attempt.error, this.offsetToSourcePos(startLoc.index))) {
27162
+ throw attempt.error;
27163
+ }
27164
+ const result = attempt.node;
27165
+ if (result && attempt.error) this.state = attempt.failState;
27105
27166
  if (missingParenErrorLoc) {
27106
27167
  this.unexpected(missingParenErrorLoc, 10);
27107
27168
  }
@@ -27442,17 +27503,36 @@ var require_lib = __commonJS({
27442
27503
  return expr;
27443
27504
  }
27444
27505
  }
27506
+ const startPos = this.offsetToSourcePos(startLoc.index);
27507
+ const isRestricted = this.tsIsArrowReturnTypeRestrictedAt(startPos);
27508
+ const allowsReturnType = isRestricted && this.state.tsArrowReturnTypeAllowed;
27445
27509
  this.next();
27446
27510
  const node = this.startNodeAt(startLoc);
27447
27511
  node.test = expr;
27448
- const oldInConditionalConsequent = this.state.inConditionalConsequent;
27449
- this.state.inConditionalConsequent = true;
27450
- node.consequent = this.parseMaybeAssignAllowIn();
27451
- this.state.inConditionalConsequent = oldInConditionalConsequent;
27512
+ node.consequent = this.tsParseWithRestrictedArrowReturnType(() => this.parseMaybeAssignAllowIn());
27452
27513
  this.expect(14);
27453
- node.alternate = this.parseMaybeAssign();
27514
+ node.alternate = isRestricted ? this.tsParseWithRestrictedArrowReturnType(() => this.parseMaybeAssign(), allowsReturnType) : this.parseMaybeAssign();
27454
27515
  return this.finishNode(node, "ConditionalExpression");
27455
27516
  }
27517
+ tsIsArrowReturnTypeRestrictedAt(sourcePos) {
27518
+ return this.state.tsArrowReturnTypeRestrictionAt === sourcePos;
27519
+ }
27520
+ tsRestrictArrowReturnTypeAt(sourcePos, allowsReturnType, genericParams = false) {
27521
+ this.state.tsArrowReturnTypeRestrictionAt = sourcePos;
27522
+ this.state.tsArrowReturnTypeAllowed = allowsReturnType;
27523
+ this.state.tsGenericArrowParams = genericParams;
27524
+ }
27525
+ tsParseWithRestrictedArrowReturnType(parse4, allowsReturnType = false, genericParams = false) {
27526
+ const oldAllowed = this.state.tsArrowReturnTypeAllowed;
27527
+ const oldGeneric = this.state.tsGenericArrowParams;
27528
+ const oldStart = this.state.tsArrowReturnTypeRestrictionAt;
27529
+ this.tsRestrictArrowReturnTypeAt(this.state.start, allowsReturnType, genericParams);
27530
+ const result = parse4();
27531
+ this.state.tsArrowReturnTypeRestrictionAt = oldStart;
27532
+ this.state.tsArrowReturnTypeAllowed = oldAllowed;
27533
+ this.state.tsGenericArrowParams = oldGeneric;
27534
+ return result;
27535
+ }
27456
27536
  parseParenItem(node, startLoc) {
27457
27537
  const newNode = super.parseParenItem(node, startLoc);
27458
27538
  if (this.eat(17)) {
@@ -27610,13 +27690,82 @@ var require_lib = __commonJS({
27610
27690
  this.resetEndLocation(decl.id);
27611
27691
  }
27612
27692
  }
27613
- parseAsyncArrowFromCallExpression(node, call) {
27614
- if (this.match(14)) {
27615
- node.returnType = this.tsParseTypeAnnotation();
27693
+ parseMaybeAssign(refExpressionErrors, afterLeftParse) {
27694
+ const startPos = this.state.start;
27695
+ if (!this.tsIsArrowReturnTypeRestrictedAt(startPos)) {
27696
+ return this.tsParseMaybeAssign(refExpressionErrors, afterLeftParse);
27697
+ }
27698
+ const oldStart = this.state.tsArrowReturnTypeRestrictionAt;
27699
+ const oldAllowed = this.state.tsArrowReturnTypeAllowed;
27700
+ const oldGeneric = this.state.tsGenericArrowParams;
27701
+ const node = this.match(10) || this.match(47) || this.isContextual(96) ? this.tsParseMaybeArrowWithRestrictedReturnType(startPos, refExpressionErrors, afterLeftParse) : this.tsParseMaybeAssign(refExpressionErrors, afterLeftParse);
27702
+ this.state.tsArrowReturnTypeRestrictionAt = oldStart;
27703
+ this.state.tsArrowReturnTypeAllowed = oldAllowed;
27704
+ this.state.tsGenericArrowParams = oldGeneric;
27705
+ return node;
27706
+ }
27707
+ tsParseWithDeferredArrowErrors(parse4) {
27708
+ if (this.optionFlags & 2048) return parse4();
27709
+ this.optionFlags |= 2048;
27710
+ try {
27711
+ return parse4();
27712
+ } finally {
27713
+ this.optionFlags &= ~2048;
27616
27714
  }
27617
- return super.parseAsyncArrowFromCallExpression(node, call);
27618
27715
  }
27619
- parseMaybeAssign(refExpressionErrors, afterLeftParse) {
27716
+ tsShouldKeepArrowErrorAt(error, startPos) {
27717
+ if (!this.tsIsArrowReturnTypeRestrictedAt(startPos)) return false;
27718
+ const returnTypeStart = this.tsArrowReturnTypeAt.get(startPos);
27719
+ return returnTypeStart !== void 0 && !tsIsInvalidArrowParamsError(error, returnTypeStart);
27720
+ }
27721
+ tsParseMaybeArrowWithRestrictedReturnType(startPos, refExpressionErrors, afterLeftParse) {
27722
+ if (!this.noArrowAt.has(startPos)) {
27723
+ const allowsReturnType = this.state.tsArrowReturnTypeAllowed;
27724
+ const parse4 = () => this.tsParseMaybeAssign(refExpressionErrors, afterLeftParse);
27725
+ let state = this.state.clone();
27726
+ const {
27727
+ tokensLength
27728
+ } = state;
27729
+ this.tsArrowReturnTypeAt.delete(startPos);
27730
+ let result = this.tryParse(parse4, state);
27731
+ const returnTypeStart = this.tsArrowReturnTypeAt.get(startPos);
27732
+ if (result.thrown && returnTypeStart !== void 0 && !tsIsInvalidArrowParamsError(result.error, returnTypeStart) && !(this.optionFlags & 2048)) {
27733
+ state = this.state.clone();
27734
+ this.optionFlags |= 2048;
27735
+ try {
27736
+ result = this.tryParse(parse4, state);
27737
+ } finally {
27738
+ this.optionFlags &= ~2048;
27739
+ }
27740
+ }
27741
+ if (result.thrown) {
27742
+ if (!this.tsArrowReturnTypeAt.has(startPos)) throw result.error;
27743
+ } else {
27744
+ var _node$extra2;
27745
+ if (result.error) this.state = result.failState;
27746
+ const node = result.node;
27747
+ if (node.type !== "ArrowFunctionExpression" || !node.returnType || (_node$extra2 = node.extra) != null && _node$extra2.parenthesized) {
27748
+ return node;
27749
+ }
27750
+ const {
27751
+ start
27752
+ } = node.returnType;
27753
+ const hasInvalidParams = result.error != null && this.state.errors.slice(state.errors.length).some((error) => tsIsInvalidArrowParamsError(error, start));
27754
+ const isUnambiguous = node.typeParameters ? this.hasPlugin("jsx") : tsHasUnambiguousArrowParams(node.params);
27755
+ if (!hasInvalidParams && (allowsReturnType || this.match(14)) || isUnambiguous && !(hasInvalidParams && node.async)) {
27756
+ if (result.error && !(this.optionFlags & 2048)) {
27757
+ throw result.error;
27758
+ }
27759
+ return node;
27760
+ }
27761
+ }
27762
+ this.noArrowAt.add(startPos);
27763
+ this.state = state;
27764
+ this.state.tokensLength = tokensLength;
27765
+ }
27766
+ return this.tsParseMaybeAssign(refExpressionErrors, afterLeftParse);
27767
+ }
27768
+ tsParseMaybeAssign(refExpressionErrors, afterLeftParse) {
27620
27769
  var _jsx, _jsx2, _typeCast, _jsx3, _typeCast2;
27621
27770
  let state;
27622
27771
  let jsx2;
@@ -27640,8 +27789,26 @@ var require_lib = __commonJS({
27640
27789
  let typeParameters;
27641
27790
  const arrow = this.tryParse((abort) => {
27642
27791
  var _expr$extra, _typeParameters;
27792
+ const startPos = this.state.start;
27793
+ if (this.noArrowAt.has(startPos)) abort();
27794
+ const allowsReturnType = !this.match(47) || this.state.tsArrowReturnTypeAllowed;
27795
+ const isRestricted = this.tsIsArrowReturnTypeRestrictedAt(startPos);
27643
27796
  typeParameters = this.tsParseTypeParameters(this.tsParseConstModifier);
27644
- const expr = super.parseMaybeAssign(refExpressionErrors, afterLeftParse);
27797
+ let expr;
27798
+ if (isRestricted) {
27799
+ const paramsStartPos = this.state.start;
27800
+ this.tsArrowReturnTypeAt.delete(paramsStartPos);
27801
+ try {
27802
+ expr = this.tsParseWithRestrictedArrowReturnType(() => super.parseMaybeAssign(refExpressionErrors, afterLeftParse), allowsReturnType, true);
27803
+ } finally {
27804
+ const returnTypeStart = this.tsArrowReturnTypeAt.get(paramsStartPos);
27805
+ if (returnTypeStart !== void 0) {
27806
+ this.tsArrowReturnTypeAt.set(startPos, returnTypeStart);
27807
+ }
27808
+ }
27809
+ } else {
27810
+ expr = super.parseMaybeAssign(refExpressionErrors, afterLeftParse);
27811
+ }
27645
27812
  if (expr.type !== "ArrowFunctionExpression" || (_expr$extra = expr.extra) != null && _expr$extra.parenthesized) {
27646
27813
  abort();
27647
27814
  }
@@ -27651,6 +27818,15 @@ var require_lib = __commonJS({
27651
27818
  expr.typeParameters = typeParameters;
27652
27819
  return expr;
27653
27820
  }, state);
27821
+ if (jsx2 && arrow.node && arrow.error && !(this.optionFlags & 2048)) {
27822
+ throw arrow.error;
27823
+ }
27824
+ if (arrow.error && this.tsShouldKeepArrowErrorAt(arrow.error, state.start)) {
27825
+ if (!arrow.node) throw arrow.error;
27826
+ this.state = arrow.failState;
27827
+ if (typeParameters) this.reportReservedArrowTypeParam(typeParameters);
27828
+ return arrow.node;
27829
+ }
27654
27830
  if (!arrow.error && !arrow.aborted) {
27655
27831
  if (typeParameters) this.reportReservedArrowTypeParam(typeParameters);
27656
27832
  return arrow.node;
@@ -27676,8 +27852,8 @@ var require_lib = __commonJS({
27676
27852
  throw ((_jsx3 = jsx2) == null ? void 0 : _jsx3.error) || arrow.error || ((_typeCast2 = typeCast) == null ? void 0 : _typeCast2.error);
27677
27853
  }
27678
27854
  reportReservedArrowTypeParam(node) {
27679
- var _node$extra2;
27680
- if (node.params.length === 1 && !node.params[0].constraint && !((_node$extra2 = node.extra) != null && _node$extra2.trailingComma) && this.getPluginOption("typescript", "disallowAmbiguousJSXLike")) {
27855
+ var _node$extra3;
27856
+ if (node.params.length === 1 && !node.params[0].constraint && !((_node$extra3 = node.extra) != null && _node$extra3.trailingComma) && this.getPluginOption("typescript", "disallowAmbiguousJSXLike")) {
27681
27857
  this.raise(TSErrors.ReservedArrowTypeParam, node);
27682
27858
  }
27683
27859
  }
@@ -27689,6 +27865,9 @@ var require_lib = __commonJS({
27689
27865
  }
27690
27866
  parseArrow(node) {
27691
27867
  if (this.match(14)) {
27868
+ const startPos = this.offsetToSourcePos(node.start);
27869
+ if (this.noArrowAt.has(startPos)) return;
27870
+ const returnTypeStart = this.sourceToOffsetPos(this.state.start);
27692
27871
  const result = this.tryParse((abort) => {
27693
27872
  const returnType = this.tsParseTypeOrTypePredicateAnnotation(14);
27694
27873
  if (this.canInsertSemicolon() || !this.match(19)) abort();
@@ -27698,6 +27877,9 @@ var require_lib = __commonJS({
27698
27877
  if (!result.thrown) {
27699
27878
  if (result.error) this.state = result.failState;
27700
27879
  node.returnType = result.node;
27880
+ if (this.tsIsArrowReturnTypeRestrictedAt(startPos)) {
27881
+ this.tsArrowReturnTypeAt.set(startPos, returnTypeStart);
27882
+ }
27701
27883
  }
27702
27884
  }
27703
27885
  return super.parseArrow(node);
@@ -27865,19 +28047,46 @@ var require_lib = __commonJS({
27865
28047
  }
27866
28048
  return super.shouldParseArrow(params);
27867
28049
  }
27868
- shouldParseAsyncArrow() {
27869
- if (this.match(14)) {
27870
- if (this.state.inConditionalConsequent) return false;
27871
- return true;
28050
+ parseAsyncArrowHead(startLoc) {
28051
+ if (!this.match(14)) return super.parseAsyncArrowHead(startLoc);
28052
+ const returnTypeStart = this.sourceToOffsetPos(this.state.start);
28053
+ const result = this.tryParse((abort) => {
28054
+ const returnType = this.tsParseTypeAnnotation();
28055
+ if (!this.match(19)) abort();
28056
+ return returnType;
28057
+ });
28058
+ if (result.aborted || result.thrown) return void 0;
28059
+ if (result.error) this.state = result.failState;
28060
+ const startPos = this.offsetToSourcePos(startLoc.index);
28061
+ if (this.tsIsArrowReturnTypeRestrictedAt(startPos)) {
28062
+ this.tsArrowReturnTypeAt.set(startPos, returnTypeStart);
27872
28063
  }
27873
- return super.shouldParseAsyncArrow();
28064
+ const node = this.startNodeAt(startLoc);
28065
+ node.returnType = result.node;
28066
+ return node;
27874
28067
  }
27875
- parseParenAndDistinguishExpression(canBeArrow) {
27876
- const oldInConditionalConsequent = this.state.inConditionalConsequent;
27877
- this.state.inConditionalConsequent = false;
27878
- const result = super.parseParenAndDistinguishExpression(canBeArrow);
27879
- this.state.inConditionalConsequent = oldInConditionalConsequent;
27880
- return result;
28068
+ atPossibleAsyncArrow(base) {
28069
+ return super.atPossibleAsyncArrow(base) && !this.noArrowAt.has(this.offsetToSourcePos(base.start));
28070
+ }
28071
+ parseMaybeConditional(refExpressionErrors) {
28072
+ if (!this.tsIsArrowReturnTypeRestrictedAt(this.state.start)) {
28073
+ return super.parseMaybeConditional(refExpressionErrors);
28074
+ }
28075
+ const allowsReturnType = this.state.tsArrowReturnTypeAllowed;
28076
+ const expr = super.parseMaybeConditional(refExpressionErrors);
28077
+ if (tokenIsAssignment(this.state.type)) {
28078
+ this.tsRestrictArrowReturnTypeAt(this.nextTokenStart(), allowsReturnType);
28079
+ }
28080
+ return expr;
28081
+ }
28082
+ parseArrowExpression(node, params, isAsync, trailingCommaLoc) {
28083
+ const startPos = this.offsetToSourcePos(node.start);
28084
+ if (this.tsIsArrowReturnTypeRestrictedAt(startPos)) {
28085
+ const genericParams = this.state.tsGenericArrowParams;
28086
+ const parse4 = () => super.parseArrowExpression(node, params, isAsync, trailingCommaLoc);
28087
+ return this.tsParseWithRestrictedArrowReturnType(genericParams && node.returnType ? () => this.tsParseWithDeferredArrowErrors(parse4) : parse4, this.state.tsArrowReturnTypeAllowed || !genericParams && tsHasUnambiguousArrowParams(params));
28088
+ }
28089
+ return super.parseArrowExpression(node, params, isAsync, trailingCommaLoc);
27881
28090
  }
27882
28091
  canHaveLeadingDecorator() {
27883
28092
  return super.canHaveLeadingDecorator() || this.isAbstractClass();
@@ -28008,7 +28217,7 @@ var require_lib = __commonJS({
28008
28217
  const firstAs = this.parseIdentifier();
28009
28218
  if (this.isContextual(94)) {
28010
28219
  const secondAs = this.parseIdentifier();
28011
- if (tokenIsKeywordOrIdentifier(this.state.type)) {
28220
+ if (isImport ? tokenIsKeywordOrIdentifier(this.state.type) : this.tsIsStartOfModuleExportName()) {
28012
28221
  hasTypeSpecifier = true;
28013
28222
  leftOfAs = firstAs;
28014
28223
  rightOfAs = isImport ? this.parseIdentifier() : this.parseModuleExportName();
@@ -28017,16 +28226,16 @@ var require_lib = __commonJS({
28017
28226
  rightOfAs = secondAs;
28018
28227
  canParseAsKeyword = false;
28019
28228
  }
28020
- } else if (tokenIsKeywordOrIdentifier(this.state.type)) {
28229
+ } else if (isImport ? tokenIsKeywordOrIdentifier(this.state.type) : this.tsIsStartOfModuleExportName()) {
28021
28230
  canParseAsKeyword = false;
28022
28231
  rightOfAs = isImport ? this.parseIdentifier() : this.parseModuleExportName();
28023
28232
  } else {
28024
28233
  hasTypeSpecifier = true;
28025
28234
  leftOfAs = firstAs;
28026
28235
  }
28027
- } else if (tokenIsKeywordOrIdentifier(this.state.type)) {
28236
+ } else if (this.tsIsStartOfModuleExportName()) {
28028
28237
  hasTypeSpecifier = true;
28029
- if (isImport) {
28238
+ if (isImport && !this.match(135)) {
28030
28239
  leftOfAs = this.parseIdentifier(true);
28031
28240
  if (!this.isContextual(94)) {
28032
28241
  this.checkReservedWord(leftOfAs.name, leftOfAs.loc.start, true, true);
@@ -28046,12 +28255,20 @@ var require_lib = __commonJS({
28046
28255
  node[rightOfAsKey] = isImport ? this.parseIdentifier() : this.parseModuleExportName();
28047
28256
  }
28048
28257
  if (!node[rightOfAsKey]) {
28049
- node[rightOfAsKey] = this.cloneIdentifier(node[leftOfAsKey]);
28258
+ if (isImport && node[leftOfAsKey].type !== "Identifier") {
28259
+ throw this.raise(Errors.ImportBindingIsString, node, {
28260
+ importName: node[leftOfAsKey].value
28261
+ });
28262
+ }
28263
+ node[rightOfAsKey] = node[leftOfAsKey].type !== "Identifier" ? this.cloneStringLiteral(node[leftOfAsKey]) : this.cloneIdentifier(node[leftOfAsKey]);
28050
28264
  }
28051
28265
  if (isImport) {
28052
28266
  this.checkIdentifier(node[rightOfAsKey], hasTypeSpecifier ? 4098 : 4096);
28053
28267
  }
28054
28268
  }
28269
+ tsIsStartOfModuleExportName() {
28270
+ return tokenIsKeywordOrIdentifier(this.state.type) || this.match(135);
28271
+ }
28055
28272
  fillOptionalPropertiesForTSESLint(node) {
28056
28273
  var _node$phase, _node$directive, _node$decorators, _node$optional, _node$typeAnnotation, _node$accessibility, _node$decorators2, _node$override, _node$readonly, _node$static, _node$declare, _node$returnType, _node$typeParameters, _node$optional2, _node$optional3, _node$accessibility2, _node$readonly2, _node$static2, _node$declare2, _node$definite, _node$readonly3, _node$typeAnnotation2, _node$accessibility3, _node$decorators3, _node$override2, _node$optional4, _node$id, _node$abstract, _node$declare3, _node$decorators4, _node$implements, _node$superTypeArgume, _node$typeParameters2, _node$declare4, _node$definite2, _node$const, _node$declare5, _node$computed, _node$qualifier, _node$options, _node$declare6, _node$extends, _node$optional5, _node$readonly4, _node$declare7, _node$global, _node$const2, _node$in, _node$out;
28057
28274
  switch (node.type) {
@@ -33337,7 +33554,7 @@ function classifyToolMutation(toolName, args = {}) {
33337
33554
  const normalized = localNotisToolSlug(toolName).toUpperCase();
33338
33555
  if (normalized === "LOCAL_NOTIS_SANDBOX_PREVIEW") {
33339
33556
  if (args.action === "status") return false;
33340
- if (["register", "open", "heartbeat", "stop"].includes(args.action)) return true;
33557
+ if (["register", "open", "heartbeat", "stop", "delete"].includes(args.action)) return true;
33341
33558
  return null;
33342
33559
  }
33343
33560
  if (normalized.includes("EXECUTE_SQL") && typeof args.query === "string") {
@@ -40684,9 +40901,15 @@ function freezePinnedArtifactSnapshot(workspace, files, sourceFiles) {
40684
40901
  function freezeSourceWorkspace(projectDir, sourceFiles) {
40685
40902
  return withAppReleaseWorkspace(projectDir, (workspace) => freezePinnedArtifactSnapshot(workspace, {}, sourceFiles), { create: true });
40686
40903
  }
40904
+ function isSpaceKey(key2) {
40905
+ return typeof key2 === "string" && /^[a-z][a-z0-9_-]{0,99}$/.test(key2);
40906
+ }
40907
+ function assertSpaceKey(key2, message) {
40908
+ if (!isSpaceKey(key2)) throw usageError(message);
40909
+ return key2;
40910
+ }
40687
40911
  function selectedBuildName(key2) {
40688
- if (typeof key2 !== "string" || !/^[a-z][a-z0-9_-]{0,99}$/.test(key2)) throw usageError("Choose a valid selected build key.");
40689
- return `space-build-${key2}.json`;
40912
+ return `space-build-${assertSpaceKey(key2, "Choose a valid selected build key.")}.json`;
40690
40913
  }
40691
40914
  function saveSelectedBuild(projectDir, key2, release) {
40692
40915
  return withAppReleaseWorkspace(projectDir, () => {
@@ -40705,6 +40928,7 @@ function saveSelectedBuild(projectDir, key2, release) {
40705
40928
  } finally {
40706
40929
  rmSync5(temporary, { force: true });
40707
40930
  }
40931
+ removeSpaceImages(key2);
40708
40932
  return join16(projectDir, NOTIS_DIR, name);
40709
40933
  }, { create: true });
40710
40934
  }
@@ -40738,14 +40962,48 @@ function saveSpaceVerification(projectDir, diagnostic) {
40738
40962
  return join16(workspace.projectDir, ".notis", name);
40739
40963
  });
40740
40964
  }
40741
- function saveSpacePendingScreenshots(projectDir, screenshots) {
40965
+ function replaceVerifyImage(name, png) {
40966
+ rmSync5(name, { force: true });
40967
+ if (png) writeFileSync9(name, png, { flag: "wx", mode: 384 });
40968
+ }
40969
+ var VERIFY_WIDTHS = [390, 1440];
40970
+ var VERIFY_LOCALES = ["en", "fr"];
40971
+ function viewImageName(key2, width) {
40972
+ if (!VERIFY_WIDTHS.includes(width)) throw usageError("Unsafe screenshot name.");
40973
+ return `view-${assertSpaceKey(key2, "Unsafe screenshot name.")}-${width}.png`;
40974
+ }
40975
+ function pendingImageName(key2, width, locale) {
40976
+ if (!VERIFY_WIDTHS.includes(width) || !VERIFY_LOCALES.includes(locale)) throw usageError("Unsafe pending screenshot name.");
40977
+ return `pending-${assertSpaceKey(key2, "Unsafe pending screenshot name.")}-${width}-${locale}.png`;
40978
+ }
40979
+ function clearSpaceScreenshots(projectDir, key2) {
40980
+ if (!isSpaceKey(key2) || !lstatSync4(join16(projectDir, NOTIS_DIR), { throwIfNoEntry: false })) return;
40981
+ withAppReleaseWorkspace(projectDir, () => removeSpaceImages(key2));
40982
+ }
40983
+ function removeSpaceImages(key2) {
40984
+ for (const width of VERIFY_WIDTHS) {
40985
+ replaceVerifyImage(viewImageName(key2, width));
40986
+ replaceVerifyImage(`view-${width}.png`);
40987
+ for (const locale of VERIFY_LOCALES) {
40988
+ replaceVerifyImage(pendingImageName(key2, width, locale));
40989
+ replaceVerifyImage(`pending-${width}-${locale}.png`);
40990
+ }
40991
+ }
40992
+ }
40993
+ function saveSpacePendingScreenshots(projectDir, key2, screenshots) {
40742
40994
  if (!screenshots?.length) return [];
40743
- return withAppReleaseWorkspace(projectDir, (workspace) => screenshots.map(({ width, locale, png }) => {
40744
- if (![390, 1440].includes(width) || !["en", "fr"].includes(locale)) throw usageError("Unsafe pending screenshot name.");
40745
- const name = `pending-${width}-${locale}.png`;
40746
- rmSync5(name, { force: true });
40747
- writeFileSync9(name, png, { flag: "wx", mode: 384 });
40748
- return join16(workspace.projectDir, ".notis", name);
40995
+ const names = screenshots.map(({ width, locale }) => pendingImageName(key2, width, locale));
40996
+ return withAppReleaseWorkspace(projectDir, (workspace) => screenshots.map(({ png }, index) => {
40997
+ replaceVerifyImage(names[index], png);
40998
+ return join16(workspace.projectDir, NOTIS_DIR, names[index]);
40999
+ }));
41000
+ }
41001
+ function saveSpaceScreenshots(projectDir, key2, screenshots) {
41002
+ const kept = new Map((screenshots || []).map((value) => [value.width, value]));
41003
+ const names = new Map([...kept.keys()].map((width) => [width, viewImageName(key2, width)]));
41004
+ return withAppReleaseWorkspace(projectDir, (workspace) => [...kept].map(([width, { png }]) => {
41005
+ replaceVerifyImage(names.get(width), png);
41006
+ return { width, path: join16(workspace.projectDir, NOTIS_DIR, names.get(width)) };
40749
41007
  }));
40750
41008
  }
40751
41009
  function spacePublicationIntent(projectDir, identity, create = null) {
@@ -42237,6 +42495,17 @@ function spaceHarnessSnapshot(release, capabilities, engine, { authorizationMode
42237
42495
  init_errors();
42238
42496
  var object2 = (value) => value && typeof value === "object" && !Array.isArray(value);
42239
42497
  var exact = (value, keys) => object2(value) && Object.keys(value).sort().join(",") === [...keys].sort().join(",");
42498
+ var SKELETON_PARAM_SETS_MAX = 4;
42499
+ function fixtureSkeletonParams(release) {
42500
+ let list;
42501
+ try {
42502
+ list = createSpaceFixtureEngine(release).context.skeletonParams;
42503
+ } catch {
42504
+ return [];
42505
+ }
42506
+ if (!Array.isArray(list)) return [];
42507
+ return list.filter((item) => object2(item) && Object.values(item).every((value) => typeof value === "string")).slice(0, SKELETON_PARAM_SETS_MAX).map((item) => structuredClone(item));
42508
+ }
42240
42509
  function createSpaceFixtureBroker({
42241
42510
  release,
42242
42511
  capabilities,
@@ -42244,12 +42513,15 @@ function createSpaceFixtureBroker({
42244
42513
  outputs = ["markdown", "screenshot"],
42245
42514
  authorizationMode = "authorize_missing",
42246
42515
  unavailableActions = [],
42247
- onFailure
42516
+ onFailure,
42517
+ params: paramsOverride,
42518
+ audience = "editor"
42248
42519
  }) {
42249
42520
  const engine = createSpaceFixtureEngine(release);
42250
42521
  const frozen = spaceHarnessSnapshot(release, capabilities, engine, { authorizationMode, unavailableActions });
42522
+ if (audience === "public") frozen.descriptor.space.viewAs = "public";
42251
42523
  const calls = [];
42252
- const params = structuredClone(engine.context.params || {});
42524
+ const params = structuredClone({ ...engine.context.params || {}, ...paramsOverride || {} });
42253
42525
  const now = engine.context.now;
42254
42526
  const fixedClock = typeof now === "string" && Number.isFinite(Date.parse(now)) ? { fixed_clock: now } : {};
42255
42527
  const value = {
@@ -42398,28 +42670,57 @@ async function verifySpaceRelease(release, {
42398
42670
  const library = await loadRenderer();
42399
42671
  rendererDigest = library.rendererDigest;
42400
42672
  pool2 = library.createBrowserPool({ concurrency: 2, maxQueue: 2 });
42673
+ const readyTimeoutMs = readyWait(timeoutMs);
42674
+ const screenshots = [];
42401
42675
  const observations = await Promise.allSettled(brokers.map(async ({ width, broker, stop }) => {
42402
42676
  const cancel = signal ? AbortSignal.any([signal, stop.signal]) : stop.signal;
42403
- const result2 = await library.renderView({ broker, pool: pool2, outputs: ["markdown", "screenshot"], width, timeoutMs, signal: cancel });
42677
+ const result2 = await library.renderView({
42678
+ broker,
42679
+ pool: pool2,
42680
+ outputs: ["markdown", "screenshot"],
42681
+ width,
42682
+ timeoutMs,
42683
+ signal: cancel,
42684
+ ...readyTimeoutMs ? { readyTimeoutMs } : {}
42685
+ });
42404
42686
  const blocked = result2.blocked_calls || [];
42687
+ const png = Buffer.from(result2.screenshot.data_base64, "base64");
42688
+ screenshots.push({ width, png });
42405
42689
  return {
42406
42690
  width,
42407
42691
  mounted: true,
42408
42692
  status: blocked.length ? "failed" : "passed",
42693
+ loaded: true,
42409
42694
  markdown_sha256: createHash14("sha256").update(result2.markdown).digest("hex"),
42410
- screenshot_sha256: createHash14("sha256").update(Buffer.from(result2.screenshot.data_base64, "base64")).digest("hex"),
42695
+ screenshot_sha256: sha256(png),
42411
42696
  screenshot_width: result2.screenshot.width,
42412
42697
  screenshot_height: result2.screenshot.height,
42413
42698
  rendered_at: result2.rendered_at,
42414
42699
  blocked_calls: blocked
42415
42700
  };
42416
42701
  }));
42417
- const renders = observations.map((value, index) => value.status === "fulfilled" ? value.value : {
42418
- width: brokers[index].width,
42419
- mounted: false,
42420
- status: "failed",
42421
- error: value.reason?.code || "render_failed"
42702
+ const renders = observations.map((value, index) => {
42703
+ if (value.status === "fulfilled") return value.value;
42704
+ const width = brokers[index].width, shot = value.reason?.code === "render_not_ready" ? value.reason.screenshot : null;
42705
+ if (!shot?.data_base64) return { width, mounted: false, status: "failed", error: value.reason?.code || "render_failed" };
42706
+ const png = Buffer.from(shot.data_base64, "base64");
42707
+ screenshots.push({ width, png });
42708
+ const mounted = value.reason.mounted === true;
42709
+ const seconds = value.reason.waitedSeconds || Math.round((readyTimeoutMs || 0) / 1e3);
42710
+ return {
42711
+ width,
42712
+ mounted,
42713
+ status: "failed",
42714
+ error: "render_not_ready",
42715
+ loaded: false,
42716
+ message: mounted ? `At ${width} px the view had not finished loading its data after ${seconds} s.` : `At ${width} px the view had not shown anything after ${seconds} s.`,
42717
+ screenshot_sha256: sha256(png),
42718
+ screenshot_width: shot.width,
42719
+ screenshot_height: shot.height,
42720
+ blocked_calls: Array.isArray(value.reason.blocked) ? value.reason.blocked : []
42721
+ };
42422
42722
  });
42723
+ screenshots.sort((left, right) => left.width - right.width);
42423
42724
  const runtimeCalls = brokers.flatMap(({ width, broker }) => broker.calls.map((call) => ({ width, ...call })));
42424
42725
  const passed = renders.every((value) => value.status === "passed") && runtimeCalls.every((call) => call.ok);
42425
42726
  const fixtureErrors = [...new Map(runtimeCalls.filter((call) => !call.ok && call.error).map((call) => [call.error, {
@@ -42429,6 +42730,7 @@ async function verifySpaceRelease(release, {
42429
42730
  ...call.actionId ? { action_id: call.actionId } : {},
42430
42731
  message: call.error
42431
42732
  }])).values()].slice(0, 10);
42733
+ const notReady = renders.filter((value) => value.error === "render_not_ready").map((value) => ({ phase: "renderer", width: value.width, message: value.message }));
42432
42734
  const result = {
42433
42735
  ...diagnostic,
42434
42736
  status: passed ? "passed" : "failed",
@@ -42439,8 +42741,9 @@ async function verifySpaceRelease(release, {
42439
42741
  browser_count: 1,
42440
42742
  renders,
42441
42743
  runtimeCalls,
42442
- errors: passed ? [] : [...fixtureErrors, { phase: "renderer", message: "At least one width or read-only fixture failed verification." }]
42744
+ errors: passed ? [] : [...fixtureErrors, ...notReady, { phase: "renderer", message: "At least one width or read-only fixture failed verification." }]
42443
42745
  };
42746
+ Object.defineProperty(result, "screenshots", { value: screenshots, enumerable: false });
42444
42747
  if (passed && typeof library.buildSkeletonDocument === "function") {
42445
42748
  const capture = await captureSpaceSkeleton({ library, pool: pool2, release, capabilities, timeoutMs, signal, authorizationMode, unavailableActions });
42446
42749
  result.skeleton = capture.skeleton;
@@ -42466,6 +42769,8 @@ async function verifySpaceRelease(release, {
42466
42769
  }
42467
42770
  }
42468
42771
  var FIXTURE_FAILURE_GRACE_MS = 1500;
42772
+ var READY_MARGIN_MS = 5e3;
42773
+ var readyWait = (timeoutMs) => timeoutMs - READY_MARGIN_MS >= 1e3 ? timeoutMs - READY_MARGIN_MS : void 0;
42469
42774
  var sha256 = (bytes) => createHash14("sha256").update(bytes).digest("hex");
42470
42775
  var captureFailure = (width, locale, error) => ({
42471
42776
  check: "capture_failed",
@@ -42478,13 +42783,17 @@ async function captureSpaceSkeleton({ library, pool: pool2, release, capabilitie
42478
42783
  const findings = [], screenshots = [], combos = [];
42479
42784
  let failed = false, document = null;
42480
42785
  const widths = library.SKELETON_WIDTHS || [390, 1440], locales = library.SKELETON_LOCALES || ["en", "fr"];
42481
- const render = (width, options) => library.renderView({ broker: createSpaceFixtureBroker({
42786
+ const marks = release.manifest.editors_only;
42787
+ const audience = marks && !marks.view ? "public" : "editor";
42788
+ const render = (width, options, params) => library.renderView({ broker: createSpaceFixtureBroker({
42482
42789
  release,
42483
42790
  capabilities,
42484
42791
  width,
42485
42792
  outputs: ["markdown"],
42486
42793
  authorizationMode,
42487
- unavailableActions
42794
+ unavailableActions,
42795
+ params,
42796
+ audience
42488
42797
  }), pool: pool2, outputs: ["markdown"], width, timeoutMs, signal, ...options });
42489
42798
  const each = async (step) => {
42490
42799
  for (const locale of locales) {
@@ -42511,6 +42820,24 @@ async function captureSpaceSkeleton({ library, pool: pool2, release, capabilitie
42511
42820
  });
42512
42821
  const measurements = {};
42513
42822
  for (const combo of combos) if (combo.final) (measurements[combo.width] ||= {})[combo.locale] = { regions: combo.final.regions };
42823
+ for (const params of fixtureSkeletonParams(release)) {
42824
+ for (const locale of locales) {
42825
+ const settled = await Promise.allSettled(widths.map(async (width) => {
42826
+ const pending = (await render(width, { pending: true, locale }, params))?.pending;
42827
+ const known = new Set((measurements[width]?.[locale]?.regions || []).map((region) => region.key));
42828
+ const valid = pending?.static ? [] : (pending?.regions || []).filter((region) => region.valid && !known.has(region.key));
42829
+ if (!valid.length) return;
42830
+ const final = (await render(width, { measure: { regions: valid }, locale }, params)).skeleton_measure;
42831
+ const added = (final?.regions || []).filter((region) => !known.has(region.key));
42832
+ if (!added.length) return;
42833
+ const entry = (measurements[width] ||= {})[locale] ||= { regions: [] };
42834
+ entry.regions = [...entry.regions, ...added];
42835
+ }));
42836
+ settled.forEach((value, index) => {
42837
+ if (value.status === "rejected") findings.push(captureFailure(widths[index], locale, value.reason));
42838
+ });
42839
+ }
42840
+ }
42514
42841
  const app = release.files[release.manifest.bundle?.js || "bundle/app.js"];
42515
42842
  if (Object.keys(measurements).length && typeof app === "string") {
42516
42843
  document = library.buildSkeletonDocument({ sourceHash: sha256(Buffer.from(app, "base64")), measurements });
@@ -42563,6 +42890,7 @@ async function captureSpaceSkeleton({ library, pool: pool2, release, capabilitie
42563
42890
  const status = document ? "captured" : failed ? "failed" : "none";
42564
42891
  return { document, screenshots, skeleton: {
42565
42892
  status,
42893
+ audience,
42566
42894
  regions: document ? Object.keys(document.regions).sort() : [],
42567
42895
  findings,
42568
42896
  pending_screenshots: screenshots.map(({ width, locale, sha256: digest }) => ({ width, locale, sha256: digest }))
@@ -43382,9 +43710,19 @@ function describePendingChanges(summary) {
43382
43710
  return parts.length ? ` ${parts.join(". ")}.` : "";
43383
43711
  }
43384
43712
  var SKELETON_FILE = "bundle/skeleton.json";
43713
+ function describeScreenshots(render) {
43714
+ const renders = render?.renders || [];
43715
+ const paths = renders.filter((value) => value.loaded && value.screenshot_path).map((value) => value.screenshot_path);
43716
+ const parts = paths.length ? [`Screenshots after the data loaded: ${paths.join(", ")}.`] : [];
43717
+ for (const value of renders.filter((item) => item.loaded === false)) {
43718
+ const message = value.message;
43719
+ if (message) parts.push(value.screenshot_path ? `${message.replace(/\.$/, "")}; ${value.screenshot_path} shows what it showed then.` : message);
43720
+ }
43721
+ return parts.length ? ` ${parts.join(" ")}` : "";
43722
+ }
43385
43723
  function describeSkeleton(skeleton) {
43386
43724
  if (!skeleton) return "";
43387
- const parts = [skeleton.status === "captured" ? `Loading skeleton measured for ${skeleton.regions.join(", ")}.` : skeleton.status === "failed" ? "The loading skeleton could not be measured; the view keeps its fallback skeleton." : ""];
43725
+ const parts = [skeleton.status === "captured" ? `Loading skeleton measured for ${skeleton.regions.join(", ")}${skeleton.audience === "public" ? ", as the public sees the view" : ""}.` : skeleton.status === "failed" ? "The loading skeleton could not be measured; the view keeps its fallback skeleton." : ""];
43388
43726
  const findings = skeleton.findings || [];
43389
43727
  if (findings.length) {
43390
43728
  const where = (value) => [value.width, value.locale].filter(Boolean).join(" ");
@@ -43403,6 +43741,7 @@ async function sourceRelease(ctx, publish, stageOnly = false) {
43403
43741
  const { directory, key: key2 } = selected(ctx);
43404
43742
  if (!ctx.options.spaceId) throw usageError("Pass --space-id <id> for the existing Space.");
43405
43743
  const intentKey = publish ? requestId(ctx) : null;
43744
+ clearSpaceScreenshots(directory, key2);
43406
43745
  const release = await prepareSpaceRelease(directory, key2);
43407
43746
  try {
43408
43747
  if (publish) requireSpaceIcon(release.manifest, key2);
@@ -43461,15 +43800,20 @@ async function sourceRelease(ctx, publish, stageOnly = false) {
43461
43800
  process.removeListener("SIGINT", cancel);
43462
43801
  process.removeListener("SIGTERM", cancel);
43463
43802
  }
43803
+ const saved = saveSpaceScreenshots(directory, key2, render.screenshots || []);
43804
+ if (render.renders) render.renders = render.renders.map((value) => {
43805
+ const path4 = saved.find((item) => item.width === value.width)?.path;
43806
+ return path4 ? { ...value, screenshot_path: path4 } : value;
43807
+ });
43464
43808
  if (render.skeleton) {
43465
- const paths = saveSpacePendingScreenshots(directory, render.pendingScreenshots || []);
43809
+ const paths = saveSpacePendingScreenshots(directory, key2, render.pendingScreenshots || []);
43466
43810
  render.skeleton.pending_screenshots = render.skeleton.pending_screenshots.map((value, index) => ({ ...value, ...paths[index] ? { path: paths[index] } : {} }));
43467
43811
  }
43468
43812
  const diagnosticPath = saveSpaceVerification(directory, { ...render, space_id: body.space_id });
43469
43813
  if (!["passed", "not_applicable_container"].includes(render.status)) {
43470
43814
  const reason = render.errors?.find((value) => value.phase === "fixture")?.message;
43471
43815
  throw usageError(
43472
- `The built Space did not pass offline render verification. Nothing was published.${reason ? ` ${reason}` : ""}`,
43816
+ `The built Space did not pass offline render verification. Nothing was published.${reason ? ` ${reason}` : ""}${describeScreenshots(render)}`,
43473
43817
  { render, diagnostic_path: diagnosticPath }
43474
43818
  );
43475
43819
  }
@@ -43507,11 +43851,11 @@ async function sourceRelease(ctx, publish, stageOnly = false) {
43507
43851
  const result = publish && !ctx.options.dryRun ? (await call(stageOnly ? "source-stage" : "source-publish", { ...body, verification: serverVerification, request_id: intentKey })).payload : serverVerification;
43508
43852
  if (publish && !ctx.options.dryRun && !stageOnly) recordPublication(directory, local, result);
43509
43853
  const data = { ...result, render, diagnostic_path: diagnosticPath, ...local.summary ? { local_changes: local.summary } : {} };
43510
- const skeletonSummary = describeSkeleton(render.skeleton);
43854
+ const skeletonSummary = describeSkeleton(render.skeleton), screenshotSummary = describeScreenshots(render);
43511
43855
  return ctx.output.emitSuccess({
43512
43856
  command: ctx.spec.command_path.join(" "),
43513
43857
  data,
43514
- humanSummary: publish && !ctx.options.dryRun ? stageOnly ? `Prepared ${key2} as revision ${result.candidate_revision}. ${result.preview_url || "This container has no executable preview."} Live source was not changed.${describePendingChanges(local.summary).replace(/\.$/, "; they go live with notis spaces promote.")}` : `Published ${key2} as revision ${result.published_revision}${result.replayed ? " (confirmed retry)" : ""}.${describeAppliedChanges(result)}${describeViewerReads(serverVerification.capabilities)}${describeCloudComputer(serverVerification.capabilities)}${skeletonSummary}` : `Verified ${key2}'s frozen source${render.status === "passed" ? ", rendered fixtures" : " (container)"} and current authorizations; nothing was published.${describePendingChanges(local.summary)}${describeViewerReads(serverVerification.capabilities)}${describeCloudComputer(serverVerification.capabilities)}${skeletonSummary}`,
43858
+ humanSummary: publish && !ctx.options.dryRun ? stageOnly ? `Prepared ${key2} as revision ${result.candidate_revision}. ${result.preview_url || "This container has no executable preview."} Live source was not changed.${describePendingChanges(local.summary).replace(/\.$/, "; they go live with notis spaces promote.")}${screenshotSummary}` : `Published ${key2} as revision ${result.published_revision}${result.replayed ? " (confirmed retry)" : ""}.${describeAppliedChanges(result)}${describeViewerReads(serverVerification.capabilities)}${describeCloudComputer(serverVerification.capabilities)}${screenshotSummary}${skeletonSummary}` : `Verified ${key2}'s frozen source${render.status === "passed" ? ", rendered fixtures" : " (container)"} and current authorizations; nothing was published.${describePendingChanges(local.summary)}${describeViewerReads(serverVerification.capabilities)}${describeCloudComputer(serverVerification.capabilities)}${screenshotSummary}${skeletonSummary}`,
43515
43859
  warnings: skeletonWarnings.length ? [...local.warnings || [], ...skeletonWarnings] : local.warnings,
43516
43860
  meta: { mutating: publish && !ctx.options.dryRun }
43517
43861
  });
@@ -46136,8 +46480,8 @@ var computerCommandSpecs = [{
46136
46480
  }
46137
46481
  }, {
46138
46482
  command_path: ["computer", "restart"],
46139
- summary: "Restart a Cloud Computer that stopped answering. Its files are kept.",
46140
- when_to_use: "Only while notis computer status says it is not responding. Whatever was running on it stops; it answers again in 1 to 2 minutes.",
46483
+ summary: "Restart your Cloud Computer, awake or not responding. Its files are kept.",
46484
+ when_to_use: "When it is stuck, slow or not responding. Whatever was running on it stops; it answers again in 1 to 2 minutes. An asleep one has nothing to restart.",
46141
46485
  args_schema: { arguments: [], options: [YES_OPTION] },
46142
46486
  examples: ["notis computer restart", "notis computer restart --yes"],
46143
46487
  mutates: true,