omp-fabric 1.26.13 → 1.26.15

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 (42) hide show
  1. package/CHANGELOG.md +35 -0
  2. package/dist/chunks/{chunk-7KKE52AS.js → chunk-673LUJCK.js} +2 -2
  3. package/dist/chunks/{chunk-JHKOG5GS.js → chunk-BV3EDWSX.js} +50 -3
  4. package/dist/chunks/chunk-BV3EDWSX.js.map +7 -0
  5. package/dist/chunks/{chunk-RFTAEH2R.js → chunk-EZWJ5GBW.js} +93 -3
  6. package/dist/chunks/{chunk-RFTAEH2R.js.map → chunk-EZWJ5GBW.js.map} +2 -2
  7. package/dist/chunks/{chunk-AVSEXLZ7.js → chunk-O5SZML2M.js} +434 -3
  8. package/dist/chunks/chunk-O5SZML2M.js.map +7 -0
  9. package/dist/chunks/{chunk-2T6EHZ5G.js → chunk-S3URDR4K.js} +1 -1
  10. package/dist/fabric-runtime-state.js +124 -18
  11. package/dist/fabric-runtime-state.js.map +2 -2
  12. package/dist/index.js +60 -1
  13. package/dist/index.js.map +3 -3
  14. package/dist/providers/image-provider.d.ts +1 -0
  15. package/dist/providers/image-provider.d.ts.map +1 -1
  16. package/dist/residency/host.js +2 -2
  17. package/dist/residency/omp-entry.js +2 -2
  18. package/dist/runtime/core-override-guest-types.js +1 -1
  19. package/dist/runtime/guest-host-sync.d.ts +5 -0
  20. package/dist/runtime/guest-host-sync.d.ts.map +1 -0
  21. package/dist/runtime/guest-types.d.ts +1 -1
  22. package/dist/runtime/guest-types.d.ts.map +1 -1
  23. package/dist/runtime/guest-types.js +1 -1
  24. package/dist/runtime/guest-web-globals.d.ts +2 -0
  25. package/dist/runtime/guest-web-globals.d.ts.map +1 -0
  26. package/dist/runtime/node-process-child-source.d.ts.map +1 -1
  27. package/dist/runtime/node-process-runtime.js +12 -2
  28. package/dist/runtime/node-process-runtime.js.map +2 -2
  29. package/dist/runtime/quickjs-runtime.d.ts +1 -1
  30. package/dist/runtime/quickjs-runtime.d.ts.map +1 -1
  31. package/dist/runtime/quickjs-runtime.js +2 -2
  32. package/dist/runtime/type-checker.d.ts.map +1 -1
  33. package/dist/runtime/type-checker.js +1 -1
  34. package/dist/type-error-guidance.d.ts.map +1 -1
  35. package/docs/architecture.md +1 -1
  36. package/docs/image.md +24 -3
  37. package/package.json +1 -1
  38. package/skills/fabric-exec/SKILL.md +4 -1
  39. package/dist/chunks/chunk-AVSEXLZ7.js.map +0 -7
  40. package/dist/chunks/chunk-JHKOG5GS.js.map +0 -7
  41. /package/dist/chunks/{chunk-7KKE52AS.js.map → chunk-673LUJCK.js.map} +0 -0
  42. /package/dist/chunks/{chunk-2T6EHZ5G.js.map → chunk-S3URDR4K.js.map} +0 -0
package/dist/index.js CHANGED
@@ -82,7 +82,7 @@ import "./chunks/chunk-DLXPTBPL.js";
82
82
  import {
83
83
  GUEST_TYPE_DECLARATIONS,
84
84
  OMP_CORE_COMPATIBILITY_ARGUMENT_TYPE_NAMES
85
- } from "./chunks/chunk-RFTAEH2R.js";
85
+ } from "./chunks/chunk-EZWJ5GBW.js";
86
86
  import {
87
87
  NESTED_TOOL_CALL_ID_PREFIX,
88
88
  getActiveRepairCompiler,
@@ -2811,6 +2811,8 @@ var SYNTAX_ERROR_PATTERN = /expected|unterminated|unexpected|invalid character/i
2811
2811
  var PAYLOAD_CALL_PATTERN = /\bomp\.(?:edit|write)\s*\(/;
2812
2812
  var UNQUOTED_PATH_HEAD = /\bomp\.(?:read|ls|write|edit)\(\s*(?:https?:\/\/|\/(?![/*])|\.\/|\.\.\/|~\/|[A-Za-z]:[\\/])/;
2813
2813
  var PROMISE_ALL_PATTERN = /\bPromise\.all\s*\(/;
2814
+ var TEMPLATE_CALL_PATTERN = /\bomp\.(bash|write|edit)\(\s*(?:\{[^`]{0,80}?)?`/g;
2815
+ var SHELL_EXPANSION_PATTERN = /^(?:[#!]|[A-Za-z_]\w*(?::|%|#|\/|\^|,|\[))/;
2814
2816
  var TUPLE_ARITY_PATTERN = /Tuple type .* of length '[0-9]+' has no element at index '[0-9]+'/;
2815
2817
  var MISSING_NAME_PATTERN = /^Cannot find name '([^']+)'/;
2816
2818
  var UNKNOWN_PROPERTY_PATTERN = /'([^']+)' does not exist in type '([^']+)'/;
@@ -2880,6 +2882,61 @@ var hasLiteralPayloadInterpolation = (code, errors) => {
2880
2882
  return name !== void 0 && code.includes(`\${${name}}`);
2881
2883
  });
2882
2884
  };
2885
+ var codeOffset = (code, line, column) => {
2886
+ const lines = code.split("\n");
2887
+ let offset = 0;
2888
+ for (let index = 0; index < line - 1 && index < lines.length; index += 1) offset += lines[index].length + 1;
2889
+ return offset + Math.max(0, column - 1);
2890
+ };
2891
+ var codePosition = (code, offset) => {
2892
+ const before = code.slice(0, offset).split("\n");
2893
+ return `line ${before.length}:${before[before.length - 1].length + 1}`;
2894
+ };
2895
+ var substitutionEnd = (code, start) => {
2896
+ let depth = 0;
2897
+ for (let index = start; index < code.length; index += 1) {
2898
+ const char = code[index];
2899
+ if (char === "{") depth += 1;
2900
+ else if (char === "}") {
2901
+ depth -= 1;
2902
+ if (depth === 0) return index;
2903
+ }
2904
+ }
2905
+ return code.length;
2906
+ };
2907
+ var brokenTemplateHint = (code, errors) => {
2908
+ const first = errors.find((error) => error.line > 0 && SYNTAX_ERROR_PATTERN.test(error.message));
2909
+ if (!first) return void 0;
2910
+ const errorOffset = codeOffset(code, first.line, first.column);
2911
+ let opening2;
2912
+ for (const match of code.matchAll(TEMPLATE_CALL_PATTERN)) {
2913
+ if (match.index + match[0].length > errorOffset) break;
2914
+ opening2 = match;
2915
+ }
2916
+ if (!opening2) return void 0;
2917
+ const tool = opening2[1];
2918
+ let index = opening2.index + opening2[0].length;
2919
+ while (index <= errorOffset && index < code.length) {
2920
+ const char = code[index];
2921
+ if (char === "\\") {
2922
+ index += 2;
2923
+ continue;
2924
+ }
2925
+ if (char === "`") {
2926
+ return `Recovery hint: the template literal passed to omp.${tool} ends at the backtick on ${codePosition(code, index)}, so the rest of the text is parsed as TypeScript. Move the text to a top-level \`payloads\` entry and reference \`payloads.key\`, or escape the backtick as \\\`.`;
2927
+ }
2928
+ if (code.startsWith("${", index)) {
2929
+ const end = substitutionEnd(code, index + 1);
2930
+ if (SHELL_EXPANSION_PATTERN.test(code.slice(index + 2, end))) {
2931
+ return `Recovery hint: \`${code.slice(index, Math.min(end + 1, index + 40))}\` on ${codePosition(code, index)} is shell parameter expansion, but inside a template literal \`\${\` starts a TypeScript expression. Escape it as \\\${, or move the script to a top-level \`payloads\` entry and reference \`payloads.key\`.`;
2932
+ }
2933
+ index = end + 1;
2934
+ continue;
2935
+ }
2936
+ index += 1;
2937
+ }
2938
+ return void 0;
2939
+ };
2883
2940
  var typeErrorRecoveryHint = (code, errors) => {
2884
2941
  for (const error of errors) {
2885
2942
  const property = UNKNOWN_PROPERTY_PATTERN.exec(error.message)?.[1];
@@ -2901,6 +2958,8 @@ var typeErrorRecoveryHint = (code, errors) => {
2901
2958
  )) {
2902
2959
  return "Recovery hint: quote filesystem paths and URLs as strings, e.g. `omp.read('/x')` or `omp.read({ path: '/x' })`. Unquoted paths are parsed as regex, division, or extra arguments.";
2903
2960
  }
2961
+ const templateHint = brokenTemplateHint(code, errors);
2962
+ if (templateHint) return templateHint;
2904
2963
  if (!PAYLOAD_CALL_PATTERN.test(code)) return void 0;
2905
2964
  if (!errors.some((error) => SYNTAX_ERROR_PATTERN.test(error.message))) {
2906
2965
  return void 0;